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)