Add permissions checking to sidebar

This commit is contained in:
Dane Everitt 2017-02-17 19:45:03 -05:00
parent 5f8572fe1a
commit 0f93ba2495
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -116,6 +116,7 @@
<i class="fa fa-terminal"></i> <span>@lang('navigation.server.console')</span> <i class="fa fa-terminal"></i> <span>@lang('navigation.server.console')</span>
</a> </a>
</li> </li>
@can('list-files', $server)
<li class="treeview <li class="treeview
@if(in_array(Route::currentRouteName(), ['server.files.index', 'server.files.edit', 'server.files.add'])) @if(in_array(Route::currentRouteName(), ['server.files.index', 'server.files.edit', 'server.files.add']))
active active
@ -130,9 +131,13 @@
</a> </a>
<ul class="treeview-menu"> <ul class="treeview-menu">
<li class="{{ (Route::currentRouteName() !== 'server.files.index' && Route::currentRouteName() !== 'server.files.edit') ?: 'active' }}"><a href="{{ route('server.files.index', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.file_browser')</a></li> <li class="{{ (Route::currentRouteName() !== 'server.files.index' && Route::currentRouteName() !== 'server.files.edit') ?: 'active' }}"><a href="{{ route('server.files.index', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.file_browser')</a></li>
@can('create-files', $server)
<li class="{{ Route::currentRouteName() !== 'server.files.add' ?: 'active' }}"><a href="{{ route('server.files.add', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.create_file')</a></li> <li class="{{ Route::currentRouteName() !== 'server.files.add' ?: 'active' }}"><a href="{{ route('server.files.add', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.create_file')</a></li>
@endcan
</ul> </ul>
</li> </li>
@endcan
@can('list-subusers', $server)
<li <li
@if(in_array(Route::currentRouteName(), ['server.subusers', 'server.subusers.new', 'server.subusers.view'])) @if(in_array(Route::currentRouteName(), ['server.subusers', 'server.subusers.new', 'server.subusers.view']))
class="active" class="active"
@ -142,6 +147,8 @@
<i class="fa fa-users"></i> <span>Subusers</span> <i class="fa fa-users"></i> <span>Subusers</span>
</a> </a>
</li> </li>
@endcan
@can('list-tasks', $server)
<li <li
@if(in_array(Route::currentRouteName(), ['server.tasks', 'server.tasks.new'])) @if(in_array(Route::currentRouteName(), ['server.tasks', 'server.tasks.new']))
class="active" class="active"
@ -154,6 +161,8 @@
</span> </span>
</a> </a>
</li> </li>
@endcan
@if(Gate::allows('view-startup', $server) || Gate::allows('view-sftp', $server) || Gate::allows('view-databases', $server) || Gate::allows('view-allocation', $server))
<li class="treeview <li class="treeview
@if(in_array(Route::currentRouteName(), ['server.settings.sftp', 'server.settings.databases', 'server.settings.startup', 'server.settings.allocation'])) @if(in_array(Route::currentRouteName(), ['server.settings.sftp', 'server.settings.databases', 'server.settings.startup', 'server.settings.allocation']))
active active
@ -167,13 +176,22 @@
</span> </span>
</a> </a>
<ul class="treeview-menu"> <ul class="treeview-menu">
@can('view-allocation', $server)
<li class="{{ Route::currentRouteName() !== 'server.settings.allocation' ?: 'active' }}"><a href="{{ route('server.settings.allocation', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.port_allocations')</a></li> <li class="{{ Route::currentRouteName() !== 'server.settings.allocation' ?: 'active' }}"><a href="{{ route('server.settings.allocation', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.port_allocations')</a></li>
@endcan
@can('view-sftp', $server)
<li class="{{ Route::currentRouteName() !== 'server.settings.sftp' ?: 'active' }}"><a href="{{ route('server.settings.sftp', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.sftp_settings')</a></li> <li class="{{ Route::currentRouteName() !== 'server.settings.sftp' ?: 'active' }}"><a href="{{ route('server.settings.sftp', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.sftp_settings')</a></li>
@endcan
@can('view-startup', $server)
<li class="{{ Route::currentRouteName() !== 'server.settings.startup' ?: 'active' }}"><a href="{{ route('server.settings.startup', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.startup_parameters')</a></li> <li class="{{ Route::currentRouteName() !== 'server.settings.startup' ?: 'active' }}"><a href="{{ route('server.settings.startup', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.startup_parameters')</a></li>
@endcan
@can('view-databases', $server)
<li class="{{ Route::currentRouteName() !== 'server.settings.databases' ?: 'active' }}"><a href="{{ route('server.settings.databases', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.databases')</a></li> <li class="{{ Route::currentRouteName() !== 'server.settings.databases' ?: 'active' }}"><a href="{{ route('server.settings.databases', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.databases')</a></li>
@endcan
</ul> </ul>
</li> </li>
@endif @endif
@endif
</ul> </ul>
</section> </section>
</aside> </aside>