Scalr\Model\Entity\EventDefinition::hasAccessPermissions PHP Метод

hasAccessPermissions() публичный Метод

См. также: Scalr\DataType\AccessPermissionsInterface::hasAccessPermissions()
public hasAccessPermissions ( $user, $environment = null, $modify = null )
    public function hasAccessPermissions($user, $environment = null, $modify = null)
    {
        $scope = $this->getScope();
        if ($modify) {
            if (!$environment) {
                $result = $scope === $this::SCOPE_ACCOUNT && $this->accountId == $user->accountId || $scope === $this::SCOPE_ENVIRONMENT && $user->hasAccessToEnvironment($this->envId);
            } else {
                $result = $scope === $this::SCOPE_ENVIRONMENT && $this->envId == $environment->id;
            }
        } else {
            if (!$environment) {
                $result = $scope === $this::SCOPE_SCALR || $scope === $this::SCOPE_ACCOUNT && $this->accountId == $user->accountId || $scope === $this::SCOPE_ENVIRONMENT && $user->hasAccessToEnvironment($this->envId);
            } else {
                $result = $scope === $this::SCOPE_SCALR || $scope === $this::SCOPE_ACCOUNT && $this->accountId == $user->accountId || $scope === $this::SCOPE_ENVIRONMENT && $this->envId == $environment->id;
            }
        }
        return $result;
    }