Modify subusers model setup

This commit is contained in:
Dane Everitt 2017-02-09 18:44:07 -05:00
parent 4f61637284
commit c8f6c93d26
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 124 additions and 29 deletions

View file

@ -39,6 +39,23 @@ class ServerPolicy
//
}
/**
* Checks if the user has the given permission on/for the server.
*
* @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server
* @param $permission
* @return bool
*/
private function checkPermission(User $user, Server $server, $permission)
{
if ($this->isOwner($user, $server)) {
return true;
}
return $user->permissions()->server($server)->permission($permission)->exists();
}
/**
* Determine if current user is the owner of a server.
*
@ -521,21 +538,4 @@ class ServerPolicy
{
return $this->checkPermission($user, $server, 'set-allocation');
}
/**
* Checks if the user has the given permission on/for the server.
*
* @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server
* @param $permission
* @return bool
*/
private function checkPermission(User $user, Server $server, $permission)
{
if ($this->isOwner($user, $server)) {
return true;
}
return $user->permissions()->server($server)->permission($permission)->exists();
}
}