« blib/lib/OpusVL/AppKit/Plugin/AppKit/FeatureList.pm
↑ Summary
lib/OpusVL/AppKit/Controller/Root.pm »
| 1 | package OpusVL::AppKit::RolesFor::Schema::AppKitAuthDB::Result::Role; | ||||||||||
| 2 | |||||||||||
| 3 | 14 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 14 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | |||||||||||
| 7 | sub setup_authdb | ||||||||||
| 8 | { | ||||||||||
| 9 | 13 | ▶ | my $class = shift; | ||||||||
|
Subroutine
setup_authdb: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 10 | |||||||||||
| 11 | 13 | $class->many_to_many( users => 'users_roles', 'user'); | |||||||||
| 12 | 13 | $class->many_to_many( aclrules => 'aclrule_roles', 'aclrule_id'); | |||||||||
| 13 | |||||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | sub can_change_any_role | ||||||||||
| 18 | { | ||||||||||
| 19 | 46 | ▶ | my $self = shift; | ||||||||
|
Subroutine
can_change_any_role: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 20 | 46 | ▶ | if(@_) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | { | ||||||||||
| 22 | # set it | ||||||||||
| 23 | 3 | ▶ | if(shift) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | { | ||||||||||
| 25 | 2 | ▶ | if($self->search_related('role_admin')->count == 0) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | { | ||||||||||
| 27 | 2 | $self->create_related('role_admin', {}); | |||||||||
| 28 | } | ||||||||||
| 29 | 2 | $self->delete_related('roles_allowed_roles'); | |||||||||
| 30 | } | ||||||||||
| 31 | else | ||||||||||
| 32 | { | ||||||||||
| 33 | 1 | $self->delete_related('role_admin'); | |||||||||
| 34 | } | ||||||||||
| 35 | } | ||||||||||
| 36 | else | ||||||||||
| 37 | { | ||||||||||
| 38 | # return it. | ||||||||||
| 39 | 43 | return $self->search_related('role_admin')->count > 0; | |||||||||
| 40 | } | ||||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 14 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||
| 46 | |||||||||||
| 47 | =pod | ||||||||||
| 48 | |||||||||||
| 49 | =encoding UTF-8 | ||||||||||
| 50 | |||||||||||
| 51 | =head1 NAME | ||||||||||
| 52 | |||||||||||
| 53 | OpusVL::AppKit::RolesFor::Schema::AppKitAuthDB::Result::Role | ||||||||||
| 54 | |||||||||||
| 55 | =head1 VERSION | ||||||||||
| 56 | |||||||||||
| 57 | version 2.22 | ||||||||||
| 58 | |||||||||||
| 59 | =head2 setup_authdb | ||||||||||
| 60 | |||||||||||
| 61 | =head2 can_change_any_role | ||||||||||
| 62 | |||||||||||
| 63 | Set the a flag to indicate the role is allowed to modify any other role. | ||||||||||
| 64 | |||||||||||
| 65 | =head1 AUTHOR | ||||||||||
| 66 | |||||||||||
| 67 | OpusVL - www.opusvl.com | ||||||||||
| 68 | |||||||||||
| 69 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 70 | |||||||||||
| 71 | This software is copyright (c) 2010 by OpusVL - www.opusvl.com. | ||||||||||
| 72 | |||||||||||
| 73 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 74 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 75 | |||||||||||
| 76 | =cut | ||||||||||