public function setRole(Role $role) { $this->roles[$role->getRoleId()] = $role; }
public function hasAuthority(Role $role, Resource $resource) { $authority = $this->findRuleByRoleAndResource($role->getRoleId(), $resource->getResourceId()); if (is_null($authority) || !$authority->isAllowed()) { throw new SecurityException(MessageCode::SECURITY_ACCESS_DENIED); } }