NAME
Mojolicious::Plugin::Fondation::Authorization - Authorization plugin — grants loading and check_perm/check_group helpers
VERSION
version 0.01
SYNOPSIS
# In myapp.conf:
plugin 'Fondation' => {
dependencies => [
'Fondation::Authorization',
],
};
DESCRIPTION
Loads user grants (permissions and groups) from the database and provides
check_perm and check_group helpers for synchronous access control.
Grants are fetched asynchronously via $c-model> once per session on
first request via an around_dispatch hook and cached in
$c->session('grants').
Subsequent requests use the cached values — no database queries.
Request flow:
is_user_authenticated?
NO → session(grants => undef) + continue (cleanup)
YES → grants in session?
YES → continue (fast path)
NO → load grants async + continue
The grant chain is:
user → user_group → group → group_perm → perm
There is no direct user-to-permission table. All permissions are inherited through group membership.
NAME
Mojolicious::Plugin::Fondation::Authorization - Permission and group authorization for Fondation
DEPENDENCIES
-
Mojolicious::Plugin::Fondation::Auth
Provides
is_user_authenticatedandcurrent_userhelpers. -
Mojolicious::Plugin::Fondation::Group
Provides
user_groupandgroupDBIx sources + models. -
Mojolicious::Plugin::Fondation::Perm
Provides
group_permandpermDBIx sources + models.
HELPERS
check_perm
if ($c->check_perm('user_create')) { ... }
check_group
if ($c->check_group('admins')) { ... }
SEE ALSO
Mojolicious::Plugin::Fondation, Mojolicious::Plugin::Fondation::Auth
AUTHOR
Daniel Brosseau dab@cpan.org
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Daniel Brosseau.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.