NAME
App::Manoc::CatalystRole::Permission - Catalyst plugin for Manoc permissions
VERSION
version 2.99.2
SYNOPSIS
sub view : Chained('object') : PathPart('view') : Args(0) {
my ( $self, $c ) = @_;
# check view permission or display permission denied page
$c->require_permission( $object, 'view' );
}
sub view : Chained('object') : PathPart('create') : Args(0) {
my ( $self, $c ) = @_;
# check view permission or display permission denied page
$c->require_permission( 'foo.create' );
}
DESCRIPTION
This Role is used as a Catalyst plugin to implement Manoc authorization control.
Permissions are mapped to roles via the %DEFAULT_ROLES
hash, merged with App::Manoc::Permission
configuration.
METHODS
check_permission ( $c, $object, $operation, [ $user ] )
Check if $user is authorized to perform $operation on $object. If $user is not specified used the currently logged user.
Instead of the $object, $operation pair permission can also be expressed as a string <class>.<operation>, e.g. "device.create"
.
If object has a specific check_permission method use C| $object->check_permission( $user, $operation ) | otherwise use the default role to group map.
If user is superadmin always return true.
require_permission
check_permission or detach to access denied page.
AUTHORS
Gabriele Mambrini <gmambro@cpan.org>
Enrico Liguori
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Gabriele Mambrini.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.