public function isGranted(string $action): bool
    {
        if (empty($this->allowed)) {
            return false;
        }

        if (isset($this->denied[$action]) || isset($this->denied[self::WILDCARD])) {
            return false;
        }

        $rules = $this->getRules($action);

        foreach ($rules as $rule) {
            if (isset($this->denied[$rule])) {
                return false;
            }
        }

        foreach ($rules as $rule) {
            if (isset($this->allowed[$rule])) {
                return true;
            }
        }

        return false;
    }
public function isGranted(string $action): bool
    {
        if (empty($this->allowed)) {
            return false;
        }

        if (isset($this->denied[$action]) || isset($this->denied[self::WILDCARD])) {
            return false;
        }

        $rules = $this->getRules($action);

        foreach ($rules as $rule) {
            if (isset($this->denied[$rule])) {
                return false;
            }
        }

        foreach ($rules as $rule) {
            if (isset($this->allowed[$rule])) {
                return true;
            }
        }

        return false;
    }
public function isGranted ( string $ action ) : bool { if ( empty ( $ this -> allowed ) ) { return false ; } if ( isset ( $ this -> denied [ $ action ] ) || isset ( $ this -> denied [ self :: WILDCARD ] ) ) { return false ; } $ rules = $ this -> getRules ( $ action ) ; foreach ( $ rules as $ rule ) { if ( isset ( $ this -> denied [ $ rule ] ) ) { return false ; } } foreach ( $ rules as $ rule ) { if ( isset ( $ this -> allowed [ $ rule ] ) ) { return true ; } } return false ; }
Returns true if the policy should allow the action
to be carried out.

@param string $action

@return bool
Returns true if the policy should allow the action to be carried out .