diff --git a/app/Policies/ServerPolicy.php b/app/Policies/ServerPolicy.php index 9df744ea2..160d107f7 100644 --- a/app/Policies/ServerPolicy.php +++ b/app/Policies/ServerPolicy.php @@ -450,6 +450,22 @@ class ServerPolicy return $user->permissions()->server($server)->permission('view-databases')->exists(); } + /** + * Check if user has permission to reset database passwords. + * + * @param Pterodactyl\Models\User $user + * @param Pterodactyl\Models\Server $server + * @return boolean + */ + public function resetDbPassword(User $user, Server $server) + { + if ($this->isOwner($user, $server)) { + return true; + } + + return $user->permissions()->server($server)->permission('reset-db-password')->exists(); + } + /** * Check if user has permission to view all tasks for a server. * @@ -546,13 +562,4 @@ class ServerPolicy return $user->permissions()->server($server)->permission('create-task')->exists(); } - public function resetDbPassword(User $user, Server $server) - { - if ($this->isOwner($user, $server)) { - return true; - } - - return $user->permissions()->server($server)->permission('create-task')->exists(); - } - } diff --git a/app/Repositories/SubuserRepository.php b/app/Repositories/SubuserRepository.php index 66db1ec8d..f13c55dbb 100644 --- a/app/Repositories/SubuserRepository.php +++ b/app/Repositories/SubuserRepository.php @@ -92,7 +92,11 @@ class SubuserRepository 'view-startup' => null, 'edit-startup' => null, 'view-sftp' => null, - 'reset-sftp' => 's:set-password' + 'reset-sftp' => 's:set-password', + + // Databases + 'view-databases' => null, + 'reset-db-password' => null ]; public function __construct() diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index a23d28bc4..93515b07e 100644 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -194,13 +194,9 @@ @can('list-files', $server)
  • {{ trans('pagination.sidebar.files') }}
  • @endcan @can('list-subusers', $server)
  • {{ trans('pagination.sidebar.subusers') }}
  • @endcan @can('list-tasks', $server)
  • Scheduled Tasks
  • @endcan - @can('view-sftp', $server) + @if(Gate::allows('view-startup', $server) || Gate::allows('view-sftp', $server) || Gate::allows('view-databases', $server))
  • {{ trans('pagination.sidebar.manage') }}
  • - @else - @can('view-startup', $server) -
  • {{ trans('pagination.sidebar.manage') }}
  • - @endcan - @endcan + @endif @endif @@ -251,13 +247,9 @@ @can('list-files', $server){{ trans('pagination.sidebar.files') }}@endcan @can('list-subusers', $server){{ trans('pagination.sidebar.subusers') }}@endcan @can('list-tasks', $server)Scheduled Tasks@endcan - @can('view-sftp', $server) + @if(Gate::allows('view-startup', $server) || Gate::allows('view-sftp', $server) || Gate::allows('view-databases', $server)) {{ trans('pagination.sidebar.manage') }} - @else - @can('view-startup', $server) - {{ trans('pagination.sidebar.manage') }} - @endcan - @endcan + @endif @endif @show diff --git a/resources/views/server/index.blade.php b/resources/views/server/index.blade.php index be07f5673..61ddf8366 100644 --- a/resources/views/server/index.blade.php +++ b/resources/views/server/index.blade.php @@ -48,7 +48,7 @@

    - @can('command', $server) + @can('send-command', $server)
    + +
    +
    +

    Database Management


    +
    +
    +
    +
    +
    +

    SFTP Management


    @@ -163,6 +163,25 @@

    Allows a user to modify startup variables for a server.

    +
    + +
    +
    +

    Database Management


    +
    +
    +
    +
    +
    +

    SFTP Management