示例#1
0
 /**
  * @param Administration $administration
  * @param string $requiredPermission
  * @return bool
  */
 public function hasAccess(User $user, Administration $administration, $requiredPermission = Permission::EDIT)
 {
     $permission = $this->manager->determineAccess($administration, $user);
     if (Permission::hasPermission($requiredPermission, $permission)) {
         return true;
     }
     return false;
 }
示例#2
0
 /**
  * Set permission
  *
  * @param string $permission
  * @throws InvalidSharePermissionException
  * @return Share
  */
 public function setPermission($permission)
 {
     if (!Permission::isPermissionValid($permission)) {
         throw new InvalidSharePermissionException();
     }
     $this->permission = $permission;
     return $this;
 }