Phalcon\Acl\Adapter\Database::isAllowed PHP Метод

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

{@inheritdoc} Example: Does Andres have access to the customers resource to create? $acl->isAllowed('Andres', 'Products', 'create'); Do guests have access to any resource to edit? $acl->isAllowed('guests', '*', 'edit');
public isAllowed ( string $role, string $resource, string $access, array $parameters = null ) : boolean
$role string
$resource string
$access string
$parameters array
Результат boolean
    public function isAllowed($role, $resource, $access, array $parameters = null)
    {
        $sql = implode(' ', ["SELECT " . $this->connection->escapeIdentifier('allowed') . " FROM {$this->accessList} AS a", 'WHERE roles_name IN (', 'SELECT ? ', "UNION SELECT roles_inherit FROM {$this->rolesInherits} WHERE roles_name = ?", "UNION SELECT '*'", ')', "AND resources_name IN (?, '*')", "AND access_name IN (?, '*')", "ORDER BY " . $this->connection->escapeIdentifier('allowed') . " DESC", 'LIMIT 1']);
        // fetch one entry...
        $allowed = $this->connection->fetchOne($sql, Db::FETCH_NUM, [$role, $role, $resource, $access]);
        if (is_array($allowed)) {
            return (bool) $allowed[0];
        }
        /**
         * Return the default access action
         */
        return $this->_defaultAccess;
    }