Advertisement
mtbrandall

ManagePolicy.php

Feb 4th, 2021
1,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2. declare(strict_types=1);
  3.  
  4.  
  5. namespace App\Policy;
  6.  
  7. use App\Controller\ManageController;
  8. use Authorization\IdentityInterface;
  9. use Authorization\Policy\Result;
  10.  
  11. /**
  12.  * Manage policy
  13.  */
  14. class ManagePolicy
  15. {
  16.     public function canIndex($user, $manageController)
  17.     {
  18.         return new Result(false, 'not-manager');
  19.     }
  20.  
  21.     public function canAdd(IdentityInterface $user, Manage $manage)
  22.     {
  23.     }
  24.     public function canEdit(IdentityInterface $user, Manage $manage)
  25.     {
  26.     }
  27.     public function canDelete(IdentityInterface $user, Manage $manage)
  28.     {
  29.     }
  30.     public function canView(IdentityInterface $user, Manage $manage)
  31.     {
  32.         return true;
  33.         //if($user->get('role') = 'root' || $user->get('role') = 'admin' || $user->get('role') = 'manager')
  34.     }
  35.    
  36.     public function userLevel(IdentityInterface $identity)
  37.     {
  38.         return $identity->get('role');
  39.     }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement