Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 'Subuser without all permissions cannot edit another Subuser's permissions' and 'PermissionTitleRow Select All applies to disabled/dis-allowed permissions' #5182

Open
wants to merge 11 commits into
base: 1.0-develop
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Support for subuser editing other subuser permissions when they don't…
… have all permissions
MackenzieMolloy committed Aug 6, 2024
commit 95dd9e7f2d536b12759beaeaa7315ad95a9e303b
Original file line number Diff line number Diff line change
@@ -67,7 +67,10 @@ protected function validatePermissionsCanBeAssigned(array $permissions)
/** @var \Pterodactyl\Services\Servers\GetUserPermissionsService $service */
$service = $this->container->make(GetUserPermissionsService::class);

if (count(array_diff($permissions, $service->handle($server, $user))) > 0) {
$subuser = $this->route()->parameter('user');
$permissionDifference = array_diff($service->handle($server, $subuser), $permissions);

if (count(array_diff($permissionDifference, $service->handle($server, $user))) > 0) {
throw new HttpForbiddenException('Cannot assign permissions to a subuser that your account does not actively possess.');
}
}