/** * Set the rule that's used if you're not authenticated * * @param $defaultRole * * @throws \BjyAuthorize\Exception\InvalidRoleException */ public function setDefaultRole($defaultRole) { if (!($defaultRole instanceof RoleInterface || is_string($defaultRole))) { throw InvalidRoleException::invalidRoleInstance($defaultRole); } $this->defaultRole = $defaultRole; }
/** * @param RoleInterface|string|null $parent * * @throws \BjyAuthorize\Exception\InvalidRoleException * * @return self */ public function setParent($parent) { if (null === $parent) { $this->parent = null; return $this; } if (is_string($parent)) { $this->parent = new Role($parent); return $this; } if ($parent instanceof RoleInterface) { $this->parent = $parent; return $this; } throw Exception\InvalidRoleException::invalidRoleInstance($parent); }
/** * Set the role that is used if you're authenticated and the identity provides no role * * @param string|\Zend\Permissions\Acl\Role\RoleInterface $authenticatedRole * * @throws \BjyAuthorize\Exception\InvalidRoleException * */ public function setAuthenticatedRole($authenticatedRole) { if (!($authenticatedRole instanceof RoleInterface || is_string($authenticatedRole))) { throw InvalidRoleException::invalidRoleInstance($authenticatedRole); } $this->authenticatedRole = $authenticatedRole; }