Prado\Security\TAuthorizationRule::__construct PHP Method

__construct() public method

Constructor.
public __construct ( $action, $users, $roles, $verb = '', $ipRules = '' )
    public function __construct($action, $users, $roles, $verb = '', $ipRules = '')
    {
        $action = strtolower(trim($action));
        if ($action === 'allow' || $action === 'deny') {
            $this->_action = $action;
        } else {
            throw new TInvalidDataValueException('authorizationrule_action_invalid', $action);
        }
        $this->_users = array();
        $this->_roles = array();
        $this->_ipRules = array();
        $this->_everyone = false;
        $this->_guest = false;
        $this->_authenticated = false;
        if (trim($users) === '') {
            $users = '*';
        }
        foreach (explode(',', $users) as $user) {
            if (($user = trim(strtolower($user))) !== '') {
                if ($user === '*') {
                    $this->_everyone = true;
                    break;
                } else {
                    if ($user === '?') {
                        $this->_guest = true;
                    } else {
                        if ($user === '@') {
                            $this->_authenticated = true;
                        } else {
                            $this->_users[] = $user;
                        }
                    }
                }
            }
        }
        if (trim($roles) === '') {
            $roles = '*';
        }
        foreach (explode(',', $roles) as $role) {
            if (($role = trim(strtolower($role))) !== '') {
                $this->_roles[] = $role;
            }
        }
        if (($verb = trim(strtolower($verb))) === '') {
            $verb = '*';
        }
        if ($verb === '*' || $verb === 'get' || $verb === 'post') {
            $this->_verb = $verb;
        } else {
            throw new TInvalidDataValueException('authorizationrule_verb_invalid', $verb);
        }
        if (trim($ipRules) === '') {
            $ipRules = '*';
        }
        foreach (explode(',', $ipRules) as $ipRule) {
            if (($ipRule = trim($ipRule)) !== '') {
                $this->_ipRules[] = $ipRule;
            }
        }
    }