/** * @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; }
/** * 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; }