Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- namespace App\Policy;
- use App\Controller\ManageController;
- use Authorization\IdentityInterface;
- use Authorization\Policy\Result;
- /**
- * Manage policy
- */
- class ManagePolicy
- {
- public function canIndex($user, $manageController)
- {
- return new Result(false, 'not-manager');
- }
- public function canAdd(IdentityInterface $user, Manage $manage)
- {
- }
- public function canEdit(IdentityInterface $user, Manage $manage)
- {
- }
- public function canDelete(IdentityInterface $user, Manage $manage)
- {
- }
- public function canView(IdentityInterface $user, Manage $manage)
- {
- return true;
- //if($user->get('role') = 'root' || $user->get('role') = 'admin' || $user->get('role') = 'manager')
- }
- public function userLevel(IdentityInterface $identity)
- {
- return $identity->get('role');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement