public function getRole($roleId, $restrictToCurrentScope = false, $modify = null)
{
$criteria = $this->getDefaultCriteria();
$criteria[] = ['id' => $roleId];
$role = Entity\Role::findOne($criteria);
/* @var $role Entity\Role */
if (!$role) {
throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, "The Role either does not exist or isn't in scope for the current Environment.");
}
//To be over-suspicious check READ access to Role object
$this->checkPermissions($role, $modify);
if ($restrictToCurrentScope && $role->getScope() !== $this->getScope()) {
throw new ApiErrorException(403, ErrorMessage::ERR_SCOPE_VIOLATION, "The Role is not either from the {$this->getScope()} scope or owned by your {$this->getScope()}.");
}
return $role;
}