> */ protected static array $permissions = [ 'websocket' => ['connect'], 'control' => ['console', 'start', 'stop', 'restart'], 'user' => ['create', 'read', 'update', 'delete'], 'file' => ['create', 'read', 'read-content', 'update', 'delete', 'archive', 'sftp'], 'backup' => ['create', 'read', 'delete', 'download', 'restore'], 'allocation' => ['read', 'create', 'update', 'delete'], 'startup' => ['read', 'update', 'docker-image'], 'database' => ['create', 'read', 'update', 'delete', 'view_password'], 'schedule' => ['create', 'read', 'update', 'delete'], 'settings' => ['rename', 'reinstall'], 'activity' => ['read'], ]; /** * @return array */ protected function casts(): array { return [ 'subuser_id' => 'integer', ]; } /** * @return Collection}> */ public static function permissions(): Collection { return Collection::make(self::$permissions)->map(fn (array $keys, string $group): array => [ 'description' => self::translation("permissions.{$group}.description"), 'keys' => array_combine($keys, array_map(fn (string $key): string => self::translation("permissions.{$group}.keys.{$key}"), $keys)), ]); } private static function translation(string $key): string { return __($key); } }