Add subuser permission for changing server icon (#2304)

This commit is contained in:
Boy132
2026-04-28 09:34:38 +02:00
committed by GitHub
parent 58dcbeac0b
commit 2ed891633c
3 changed files with 7 additions and 3 deletions

View File

@@ -60,6 +60,7 @@ enum SubuserPermission: string
case SettingsRename = 'settings.rename';
case SettingsDescription = 'settings.description';
case SettingsReinstall = 'settings.reinstall';
case SettingsChangeIcon = 'settings.change-icon';
/** @return string[] */
public function split(): array

View File

@@ -81,9 +81,11 @@ class Settings extends ServerFormPage
->imageSize(150)
->columnSpanFull()
->alignJustify(),
UploadIcon::make(),
UploadIcon::make()
->authorize(fn (Server $server) => user()?->can(SubuserPermission::SettingsChangeIcon, $server)),
DeleteIcon::make()
->iconStoragePath(Server::getIconStoragePath()),
->iconStoragePath(Server::getIconStoragePath())
->authorize(fn (Server $server) => user()?->can(SubuserPermission::SettingsChangeIcon, $server)),
]),
TextInput::make('uuid')
->label(trans('server/setting.server_info.uuid'))

View File

@@ -52,9 +52,10 @@ return [
'startup_update' => 'Allows a user to modify the startup variables for the server.',
'startup_docker_image' => 'Allows a user to modify the Docker image used when running the server.',
'settings_reinstall' => 'Allows a user to trigger a reinstall of this server.',
'settings_rename' => 'Allows a user to rename this server.',
'settings_description' => 'Allows a user to change the description of this server.',
'settings_reinstall' => 'Allows a user to trigger a reinstall of this server.',
'settings_change_icon' => 'Allows a user to change the icon of this server.',
'activity_read' => 'Allows a user to view the activity logs for the server.',