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,63 +116,81 @@
<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>
<li class="treeview @can('list-files', $server)
@if(in_array(Route::currentRouteName(), ['server.files.index', 'server.files.edit', 'server.files.add'])) <li class="treeview
active @if(in_array(Route::currentRouteName(), ['server.files.index', 'server.files.edit', 'server.files.add']))
@endif active
"> @endif
<a href="#"> ">
<i class="fa fa-files-o"></i> <a href="#">
<span>@lang('navigation.server.file_management')</span> <i class="fa fa-files-o"></i>
<span class="pull-right-container"> <span>@lang('navigation.server.file_management')</span>
<i class="fa fa-angle-left pull-right"></i> <span class="pull-right-container">
</span> <i class="fa fa-angle-left pull-right"></i>
</a> </span>
<ul class="treeview-menu"> </a>
<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> <ul class="treeview-menu">
<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.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>
</ul> @can('create-files', $server)
</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>
<li @endcan
@if(in_array(Route::currentRouteName(), ['server.subusers', 'server.subusers.new', 'server.subusers.view'])) </ul>
class="active" </li>
@endif @endcan
> @can('list-subusers', $server)
<a href="{{ route('server.subusers', $server->uuidShort)}}"> <li
<i class="fa fa-users"></i> <span>Subusers</span> @if(in_array(Route::currentRouteName(), ['server.subusers', 'server.subusers.new', 'server.subusers.view']))
</a> class="active"
</li> @endif
<li >
@if(in_array(Route::currentRouteName(), ['server.tasks', 'server.tasks.new'])) <a href="{{ route('server.subusers', $server->uuidShort)}}">
class="active" <i class="fa fa-users"></i> <span>Subusers</span>
@endif </a>
> </li>
<a href="{{ route('server.tasks', $server->uuidShort)}}"> @endcan
<i class="fa fa-clock-o"></i> <span>@lang('navigation.server.task_management')</span> @can('list-tasks', $server)
<span class="pull-right-container"> <li
<span class="label label-primary pull-right">{{ \Pterodactyl\Models\Task::select('id')->where('server', $server->id)->where('active', 1)->count() }}</span> @if(in_array(Route::currentRouteName(), ['server.tasks', 'server.tasks.new']))
</span> class="active"
</a> @endif
</li> >
<li class="treeview <a href="{{ route('server.tasks', $server->uuidShort)}}">
@if(in_array(Route::currentRouteName(), ['server.settings.sftp', 'server.settings.databases', 'server.settings.startup', 'server.settings.allocation'])) <i class="fa fa-clock-o"></i> <span>@lang('navigation.server.task_management')</span>
active <span class="pull-right-container">
@endif <span class="label label-primary pull-right">{{ \Pterodactyl\Models\Task::select('id')->where('server', $server->id)->where('active', 1)->count() }}</span>
"> </span>
<a href="#"> </a>
<i class="fa fa-gears"></i> </li>
<span>@lang('navigation.server.configuration')</span> @endcan
<span class="pull-right-container"> @if(Gate::allows('view-startup', $server) || Gate::allows('view-sftp', $server) || Gate::allows('view-databases', $server) || Gate::allows('view-allocation', $server))
<i class="fa fa-angle-left pull-right"></i> <li class="treeview
</span> @if(in_array(Route::currentRouteName(), ['server.settings.sftp', 'server.settings.databases', 'server.settings.startup', 'server.settings.allocation']))
</a> active
<ul class="treeview-menu"> @endif
<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.sftp' ?: 'active' }}"><a href="{{ route('server.settings.sftp', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> @lang('navigation.server.sftp_settings')</a></li> <a href="#">
<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> <i class="fa fa-gears"></i>
<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> <span>@lang('navigation.server.configuration')</span>
</ul> <span class="pull-right-container">
</li> <i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<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>
@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>
@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>
@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>
@endcan
</ul>
</li>
@endif
@endif @endif
</ul> </ul>
</section> </section>