NAME

Punk::Model::Grant - the grants table Punk::Plugin::Authorisation reads

DESCRIPTION

Shipped for the application that turns grants on without a model of its own: plugin 'Authorisation' => { grants => 'Grant' } uses <AppClass>::Model::Grant when it exists and this one otherwise.

One row is one grant - subject, action, object - and the unique index over the three is what makes granting twice a no-op rather than two rows. object_id is text because the objects an application names are not all one table nor all one key type; the rule that reads it knows what it means.

With Punk-Sqitch the table is the punk_authz project. The DDL, for an application that manages its schema another way:

CREATE TABLE authz_grants (
    id          INTEGER PRIMARY KEY AUTOINCREMENT,
    subject_id  INTEGER NOT NULL,
    action      TEXT    NOT NULL,
    object_id   TEXT    NOT NULL,
    granted_by  INTEGER,
    created     INTEGER
);
CREATE UNIQUE INDEX authz_grants_one ON authz_grants (subject_id, action, object_id);
CREATE INDEX authz_grants_object ON authz_grants (action, object_id);

SEE ALSO

Punk::Plugin::Authorisation, Punk::Model.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)