mtbrandall

ManagePolicy.php

Feb 4th, 2021 (edited)
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. <?php
  2. declare(strict_types=1);
  3.  
  4.  
  5. namespace App\Policy;
  6.  
  7. use App\Model\Entity\Manage;
  8. use Authorization\IdentityInterface;
  9.  
  10. /**
  11.  * Manage policy
  12.  */
  13. class ManagePolicy
  14. {
  15.     public function canIndex(IdentityInterface $user, ManageController $manageController)
  16.     {
  17.         return true;   
  18.     }
  19.  
  20.    
  21.     /**
  22.      * Check if $user can add Manage
  23.      *
  24.      * @param \Authorization\IdentityInterface $user The user.
  25.      * @param \App\Model\Entity\Manage $manage
  26.      * @return bool
  27.      */
  28.     public function canAdd(IdentityInterface $user, Manage $manage)
  29.     {
  30.     }
  31.  
  32.     /**
  33.      * Check if $user can edit Manage
  34.      *
  35.      * @param \Authorization\IdentityInterface $user The user.
  36.      * @param \App\Model\Entity\Manage $manage
  37.      * @return bool
  38.      */
  39.     public function canEdit(IdentityInterface $user, Manage $manage)
  40.     {
  41.     }
  42.  
  43.     /**
  44.      * Check if $user can delete Manage
  45.      *
  46.      * @param \Authorization\IdentityInterface $user The user.
  47.      * @param \App\Model\Entity\Manage $manage
  48.      * @return bool
  49.      */
  50.     public function canDelete(IdentityInterface $user, Manage $manage)
  51.     {
  52.     }
  53.  
  54.     /**
  55.      * Check if $user can view Manage
  56.      *
  57.      * @param \Authorization\IdentityInterface $user The user.
  58.      * @param \App\Model\Entity\Manage $manage
  59.      * @return bool
  60.      */
  61.     public function canView(IdentityInterface $user, Manage $manage)
  62.     {
  63.         if($user->get('role') = 'root' || $user->get('role') = 'admin' || $user->get('role') = 'manager')
  64.     }
  65.    
  66.     public function userLevel(IdentityInterface $identity)
  67.     {
  68.         return $identity->get('role');
  69.     }
  70. }
  71.  
Add Comment
Please, Sign In to add comment