Small fixes for SAML

The SAML routes are in a service provide (sigh), so they did not have the `web` middleware group assigned to it.

I also added some additional checks so that the setup blade won’t fail (the migrations wouldn’t have been run yet, so outside of a try/catch, it would return an error since those tables don’t exist.)
This commit is contained in:
snipe 2020-11-24 13:51:02 -08:00
parent b2660002b9
commit 973eacf6c3
3 changed files with 41 additions and 16 deletions

View file

@ -17,16 +17,41 @@ class AssetCountForSidebar
*/
public function handle($request, Closure $next)
{
$total_rtd_sidebar = Asset::RTD()->count();
$total_deployed_sidebar = Asset::Deployed()->count();
$total_archived_sidebar = Asset::Archived()->count();
$total_pending_sidebar = Asset::Pending()->count();
$total_undeployable_sidebar = Asset::Undeployable()->count();
view()->share('total_rtd_sidebar', $total_rtd_sidebar);
view()->share('total_deployed_sidebar', $total_deployed_sidebar);
view()->share('total_archived_sidebar', $total_archived_sidebar);
view()->share('total_pending_sidebar', $total_pending_sidebar);
view()->share('total_undeployable_sidebar', $total_undeployable_sidebar);
try
{
$total_rtd_sidebar = Asset::RTD()->count();
view()->share('total_rtd_sidebar', $total_rtd_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_deployed_sidebar = Asset::Deployed()->count();
view()->share('total_deployed_sidebar', $total_deployed_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_archived_sidebar = Asset::Archived()->count();
view()->share('total_archived_sidebar', $total_archived_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_pending_sidebar = Asset::Pending()->count();
view()->share('total_pending_sidebar', $total_pending_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
try {
$total_undeployable_sidebar = Asset::Undeployable()->count();
view()->share('total_undeployable_sidebar', $total_undeployable_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
return $next($request);
}

View file

@ -49,7 +49,7 @@ class SamlServiceProvider extends ServiceProvider
'uses' => 'Auth\SamlController@login' ]
);
Route::group(['prefix' => 'admin','middleware' => ['auth', 'authorize:superuser']], function () {
Route::group(['prefix' => 'admin','middleware' => ['web','auth', 'authorize:superuser']], function () {
Route::get('saml', ['as' => 'settings.saml.index','uses' => 'SettingsController@getSamlSettings' ]);
Route::post('saml', ['as' => 'settings.saml.save','uses' => 'SettingsController@postSamlSettings' ]);

View file

@ -422,7 +422,7 @@
<i class="fa fa-circle-o text-blue"></i>
{{ trans('general.all') }}
{{ trans('general.deployed') }}
({{ ($total_deployed_sidebar) ? $total_deployed_sidebar : '' }})
({{ (isset($total_deployed_sidebar)) ? $total_deployed_sidebar : '' }})
</a>
</li>
<li{!! (Request::query('status') == 'RTD' ? ' class="active"' : '') !!}>
@ -430,25 +430,25 @@
<i class="fa fa-circle-o text-green"></i>
{{ trans('general.all') }}
{{ trans('general.ready_to_deploy') }}
({{ ($total_rtd_sidebar) ? $total_rtd_sidebar : '' }})
({{ (isset($total_rtd_sidebar)) ? $total_rtd_sidebar : '' }})
</a>
</li>
<li{!! (Request::query('status') == 'Pending' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Pending') }}"><i class="fa fa-circle-o text-orange"></i>
{{ trans('general.all') }}
{{ trans('general.pending') }}
({{ ($total_pending_sidebar) ? $total_pending_sidebar : '' }})
({{ (isset($total_pending_sidebar)) ? $total_pending_sidebar : '' }})
</a>
</li>
<li{!! (Request::query('status') == 'Undeployable' ? ' class="active"' : '') !!} ><a href="{{ url('hardware?status=Undeployable') }}"><i class="fa fa-times text-red"></i>
{{ trans('general.all') }}
{{ trans('general.undeployable') }}
({{ ($total_undeployable_sidebar) ? $total_undeployable_sidebar : '' }})
({{ (isset($total_undeployable_sidebar)) ? $total_undeployable_sidebar : '' }})
</a>
</li>
<li{!! (Request::query('status') == 'Archived' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Archived') }}"><i class="fa fa-times text-red"></i>
{{ trans('general.all') }}
{{ trans('admin/hardware/general.archived') }}
({{ ($total_archived_sidebar) ? $total_archived_sidebar : '' }})
({{ (isset($total_archived_sidebar)) ? $total_archived_sidebar : '' }})
</a>
</li>
<li{!! (Request::query('status') == 'Requestable' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Requestable') }}"><i class="fa fa-check text-blue"></i>