public function setPolicy(int $policy)
    {
        if (!($policy === Rule::ALLOW || $policy === Rule::DENY || $policy === Rule::INHERIT || $policy === Rule::NOINHERIT))
            throw new Exception("Policy must be either Rule::ALLOW, Rule::DENY, Rule::INHERIT or Rule::NOINHERIT");

        if ($policy === Rule::NOINHERIT && !empty($this->action))
            throw new Exception("Rule::NOINHERIT can not be used in combination with an action");

        if ($policy === Rule::NOINHERIT && !empty($this->role_id))
            throw new Exception("Rule::NOINHERIT can not be used in combination with a role");

        if ($policy !== $this->policy)
        {
            $this->policy = $policy;
            $this->changed = true;
        }
    }
public function setPolicy(int $policy)
    {
        if (!($policy === Rule::ALLOW || $policy === Rule::DENY || $policy === Rule::INHERIT || $policy === Rule::NOINHERIT))
            throw new Exception("Policy must be either Rule::ALLOW, Rule::DENY, Rule::INHERIT or Rule::NOINHERIT");

        if ($policy === Rule::NOINHERIT && !empty($this->action))
            throw new Exception("Rule::NOINHERIT can not be used in combination with an action");

        if ($policy === Rule::NOINHERIT && !empty($this->role_id))
            throw new Exception("Rule::NOINHERIT can not be used in combination with a role");

        if ($policy !== $this->policy)
        {
            $this->policy = $policy;
            $this->changed = true;
        }
    }
public function setPolicy ( int $ policy ) { if ( ! ( $ policy === Rule :: ALLOW || $ policy === Rule :: DENY || $ policy === Rule :: INHERIT || $ policy === Rule :: NOINHERIT ) ) throw new Exception ( "Policy must be either Rule::ALLOW, Rule::DENY, Rule::INHERIT or Rule::NOINHERIT" ) ; if ( $ policy === Rule :: NOINHERIT && ! empty ( $ this -> action ) ) throw new Exception ( "Rule::NOINHERIT can not be used in combination with an action" ) ; if ( $ policy === Rule :: NOINHERIT && ! empty ( $ this -> role_id ) ) throw new Exception ( "Rule::NOINHERIT can not be used in combination with a role" ) ; if ( $ policy !== $ this -> policy ) { $ this -> policy = $ policy ; $ this -> changed = true ; } }
Set the policy on the entity
@param policy integer Should be one of Rule::ALLOW, Rule::DENY or Rule::UNDEFINED
@throws Wedeto\ACL\Exception When the Rule is not ALLOW, DENY or UNDEFINED
Set the policy on the entity