Skip to content

Support authorizer to check allowed statements #59

Description

@clue
function myguard(int $action, ...$args)
{
    if ($action === SQLite3::READ) {
        list($table, $column) = $args;

        if ($table === 'users') {
            return SQLite3::OK;
        }

        return SQLite3::IGNORE;
    }

    return SQLite3::DENY;
}


$db = new Clue\React\Sqlite\SqliteClient(':memory:');

$db->on('open', function () use ($db) {
    $db->setAuthorizer('myguard');
});

$db->query('SELECT * FROM users')->then('var_dump');

See https://www.php.net/manual/en/sqlite3.setauthorizer.php (PHP 8+) and http://sqlite.org/c3ref/set_authorizer.html
Refs #47, #54, #58

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needednew featureNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions