Update all of the permissions checking to be constant based

This commit is contained in:
Dane Everitt 2020-03-22 15:31:25 -07:00
parent 605c154812
commit 23d594f655
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
18 changed files with 98 additions and 40 deletions

View file

@ -2,7 +2,7 @@
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Files;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Permission;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
class CreateFolderRequest extends ClientApiRequest
@ -10,11 +10,11 @@ class CreateFolderRequest extends ClientApiRequest
/**
* Checks that the authenticated user is allowed to create files on the server.
*
* @return bool
* @return string
*/
public function authorize(): bool
public function permission(): string
{
return $this->user()->can('file.create', $this->getModel(Server::class));
return Permission::ACTION_FILE_CREATE;
}
/**