Gets roles by specified identifier of the Environment
public getAclRolesByEnvironment ( integer $envId, boolean $ignoreCache = false ) : Scalr\Acl\Role\AccountRoleSuperposition | ||
$envId | integer | The identifier of the Environment |
$ignoreCache | boolean | optional Whether it should ignore cache |
Résultat | Scalr\Acl\Role\AccountRoleSuperposition | Returns the list of the roles of account level by specified environment |
/** * @param User $user The User Entity * @param Environment $environment optional The Environment Entity * @param string|bool $modify optional ACL Permission Identifier or boolean flag whether it should check modify * permissions or not. * @return bool */ public function hasAccessPermissions($user, $environment = null, $modify = null) { $access = $environment && $this->envId == $environment->id; if (is_bool($modify)) { $modify = $modify ? Acl::PERM_FARMS_UPDATE : null; } if ($access) { $superposition = $user->getAclRolesByEnvironment($environment->id); $access = $superposition->isAllowed(Acl::RESOURCE_FARMS, $modify); if (!$access && $this->hasUserTeamOwnership($user)) { $access = $superposition->isAllowed(Acl::RESOURCE_TEAM_FARMS, $modify); } if (!$access && $this->ownerId && $user->id == $this->ownerId) { $access = $superposition->isAllowed(Acl::RESOURCE_OWN_FARMS, $modify); } } return $access; }