Merge branch 'develop' of https://github.com/snipe/snipe-it into develop

This commit is contained in:
snipe 2021-04-20 14:54:29 -07:00
commit d40fe1b683
5 changed files with 87 additions and 11 deletions

View file

@ -58,12 +58,12 @@ class LoginController extends Controller
* *
* @return void * @return void
*/ */
public function __construct(LdapAd $ldap, Saml $saml) public function __construct(/*LdapAd $ldap, */ Saml $saml)
{ {
parent::__construct(); parent::__construct();
$this->middleware('guest', ['except' => ['logout','postTwoFactorAuth','getTwoFactorAuth','getTwoFactorEnroll']]); $this->middleware('guest', ['except' => ['logout','postTwoFactorAuth','getTwoFactorAuth','getTwoFactorEnroll']]);
Session::put('backUrl', \URL::previous()); Session::put('backUrl', \URL::previous());
$this->ldap = $ldap; // $this->ldap = $ldap;
$this->saml = $saml; $this->saml = $saml;
} }
@ -140,10 +140,10 @@ class LoginController extends Controller
* *
* @throws \Exception * @throws \Exception
*/ */
private function loginViaLdap(Request $request): User private function loginViaLdap(LdapAd $ldap, Request $request): User
{ {
try { try {
return $this->ldap->ldapLogin($request->input('username'), $request->input('password')); return $ldap->ldapLogin($request->input('username'), $request->input('password'));
} catch (\Exception $ex) { } catch (\Exception $ex) {
LOG::debug("LDAP user login: " . $ex->getMessage()); LOG::debug("LDAP user login: " . $ex->getMessage());
throw new \Exception($ex->getMessage()); throw new \Exception($ex->getMessage());
@ -217,7 +217,7 @@ class LoginController extends Controller
$user = null; $user = null;
// Should we even check for LDAP users? // Should we even check for LDAP users?
if ($this->ldap->init()) { if (Setting::getSettings()->ldap_enabled) { // avoid hitting the $this->ldap
LOG::debug("LDAP is enabled."); LOG::debug("LDAP is enabled.");
try { try {
LOG::debug("Attempting to log user in by LDAP authentication."); LOG::debug("Attempting to log user in by LDAP authentication.");

View file

@ -2,8 +2,9 @@
use App\Services\LdapAd; use App\Services\LdapAd;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Support\DeferrableProvider;
class LdapServiceProvider extends ServiceProvider class LdapServiceProvider extends ServiceProvider implements DeferrableProvider
{ {
/** /**
@ -26,4 +27,14 @@ class LdapServiceProvider extends ServiceProvider
{ {
$this->app->singleton(LdapAd::class, LdapAd::class); $this->app->singleton(LdapAd::class, LdapAd::class);
} }
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [LdapAd::class];
}
} }

View file

@ -11,7 +11,7 @@
$settings->labels_width = $settings->labels_width - $settings->labels_display_sgutter; $settings->labels_width = $settings->labels_width - $settings->labels_display_sgutter;
$settings->labels_height = $settings->labels_height - $settings->labels_display_bgutter; $settings->labels_height = $settings->labels_height - $settings->labels_display_bgutter;
// Leave space on bottom for 1D barcode if necessary // Leave space on bottom for 1D barcode if necessary
$qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->alt_barcode!='') ? $settings->labels_height - .3 : $settings->labels_height - .3; $qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->alt_barcode!='') ? $settings->labels_height - .3 : $settings->labels_height - 0.1;
?> ?>
<style> <style>
@ -61,8 +61,8 @@ $qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->alt_barcode!='')
height: {{ $settings->labels_height }}in; height: {{ $settings->labels_height }}in;
padding-top: {{$settings->labels_display_bgutter}}in; padding-top: {{$settings->labels_display_bgutter}}in;
font-family: arial, helvetica, sans-serif; font-family: arial, helvetica, sans-serif;
font-size: {{$settings->labels_fontsize}}; font-size: {{$settings->labels_fontsize}}pt;
padding-right: .01in; padding-right: .0001in;
overflow: hidden !important; overflow: hidden !important;
display: inline; display: inline;
word-wrap: break-word; word-wrap: break-word;
@ -164,4 +164,4 @@ $qr_size = ($settings->alt_barcode_enabled=='1') && ($settings->alt_barcode!='')
</body> </body>
</html> </html>

View file

@ -28,7 +28,7 @@
</script> </script>
{{-- stylesheets --}} {{-- stylesheets --}}
<link rel="stylesheet" href="{{ mix('css/dist/all.css') }}"> <link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">
@if (($snipeSettings) && ($snipeSettings->allow_user_skin==1) && Auth::check() && Auth::user()->present()->skin != '') @if (($snipeSettings) && ($snipeSettings->allow_user_skin==1) && Auth::check() && Auth::user()->present()->skin != '')
<link rel="stylesheet" href="{{ mix('css/dist/skins/skin-'.Auth::user()->present()->skin.'.min.css') }}"> <link rel="stylesheet" href="{{ mix('css/dist/skins/skin-'.Auth::user()->present()->skin.'.min.css') }}">
@else @else

View file

@ -82,6 +82,71 @@
</div><!-- /.box-body --> </div><!-- /.box-body -->
</div> <!--/.box--> </div> <!--/.box-->
<div class="box box-default">
<div class="box-header with-border">
<div class="box-heading">
<h2 class="box-title">{{ trans('general.accessories') }}</h2>
</div>
</div>
<div class="box-body">
<div class="table table-responsive">
<table
data-columns="{{ \App\Presenters\AccessoryPresenter::dataTableLayout() }}"
data-cookie-id-table="accessoriesListingTable"
data-pagination="true"
data-id-table="accessoriesListingTable"
data-search="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
data-show-refresh="true"
data-sort-order="asc"
id="accessoriesListingTable"
class="table table-striped snipe-table"
data-url="{{route('api.accessories.index', ['location_id' => $location->id]) }}"
data-export-options='{
"fileName": "export-locations-{{ str_slug($location->name) }}-accessories-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'>
</table>
</div><!-- /.table-responsive -->
</div><!-- /.box-body -->
</div> <!--/.box-->
<div class="box box-default">
<div class="box-header with-border">
<div class="box-heading">
<h2 class="box-title">{{ trans('general.consumables') }}</h2>
</div>
</div>
<div class="box-body">
<div class="table table-responsive">
<table
data-columns="{{ \App\Presenters\ConsumablePresenter::dataTableLayout() }}"
data-cookie-id-table="consumablesListingTable"
data-pagination="true"
data-id-table="consumablesListingTable"
data-search="true"
data-side-pagination="server"
data-show-columns="true"
data-show-export="true"
data-show-refresh="true"
data-sort-order="asc"
id="consumablesListingTable"
class="table table-striped snipe-table"
data-url="{{route('api.consumables.index', ['location_id' => $location->id]) }}"
data-export-options='{
"fileName": "export-locations-{{ str_slug($location->name) }}-consumables-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
}'>
</table>
</div><!-- /.table-responsive -->
</div><!-- /.box-body -->
</div> <!--/.box-->
<div class="box box-default"> <div class="box box-default">
<div class="box-header with-border"> <div class="box-header with-border">