src/core/ACL.php
protected function match($role, $action): bool {
        $roles = $actions = ['*'];

        $allow = false;

        if ($role != '*')
            array_unshift($roles, $role);
        if ($action != '*')
            array_unshift($actions, $action);

        // Ищем наиболее подходящее правило. Идем от частного к общему.
        foreach ($roles as $_role) {
            foreach ($actions as $_action) {
                if (isset($this->_rules[$_role][$_action])) {
                    $allow = $this->_rules[$_role][$_action];
                    break 2;
                }
            }
        }

        return $allow === true;
    }
protected function match($role, $action): bool {
        $roles = $actions = ['*'];

        $allow = false;

        if ($role != '*')
            array_unshift($roles, $role);
        if ($action != '*')
            array_unshift($actions, $action);

        // Ищем наиболее подходящее правило. Идем от частного к общему.
        foreach ($roles as $_role) {
            foreach ($actions as $_action) {
                if (isset($this->_rules[$_role][$_action])) {
                    $allow = $this->_rules[$_role][$_action];
                    break 2;
                }
            }
        }

        return $allow === true;
    }
protected function match ( $ role , $ action ) : bool { $ roles = $ actions = [ '*' ] ; $ allow = false ; if ( $ role != '*' ) array_unshift ( $ roles , $ role ) ; if ( $ action != '*' ) array_unshift ( $ actions , $ action ) ; // Ищем наиболее подходящее правило. Идем от частного к общему. foreach ( $ roles as $ _role ) { foreach ( $ actions as $ _action ) { if ( isset ( $ this -> _rules [ $ _role ] [ $ _action ] ) ) { $ allow = $ this -> _rules [ $ _role ] [ $ _action ] ; break 2 ; } } } return $ allow === true ; }
Check if a role is allowed to an action.

@param $role
@param $action
@return bool
Check if a role is allowed to an action .