line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Articulate::Authorisation::OwnerOverride;
|
2
|
5
|
|
|
5
|
|
20549
|
use strict;
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
181
|
|
3
|
5
|
|
|
5
|
|
20
|
use warnings;
|
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
110
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
559
|
use Moo;
|
|
5
|
|
|
|
|
15076
|
|
|
5
|
|
|
|
|
30
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Articulate::Authorisation::OwnerOverride - always say yes to the owner
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 CONFIGURATION
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Put this in your config:
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
plugins:
|
19
|
|
|
|
|
|
|
Articulate::Authorisation:
|
20
|
|
|
|
|
|
|
providers:
|
21
|
|
|
|
|
|
|
- Articulate::Authorisation::OwnerOverride
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Or, if you want the owner
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
plugins:
|
26
|
|
|
|
|
|
|
Articulate::Authorisation:
|
27
|
|
|
|
|
|
|
providers:
|
28
|
|
|
|
|
|
|
- class: Articulate::Authorisation::OwnerOverride
|
29
|
|
|
|
|
|
|
args:
|
30
|
|
|
|
|
|
|
owner: administrator
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 ATTRIBUTES
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head3 owner
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
The username of the owner. Defaults to C.
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has owner =>
|
41
|
|
|
|
|
|
|
is => 'rw',
|
42
|
|
|
|
|
|
|
default => sub{'owner'};
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head3 new
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Yep, C works just as you'd expect.
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head3 permitted
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Grants any request if the user asking is the owner. By default this is the user called C, but it could be someone else, if the C attribute is set.
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub permitted {
|
57
|
6
|
|
|
6
|
1
|
24
|
my $self = shift;
|
58
|
6
|
|
|
|
|
17
|
my $permission = shift;
|
59
|
6
|
100
|
50
|
|
|
67
|
$permission->grant('Site owner can do anything') if ( ( $permission->user_id // '' ) eq $self->owner );
|
60
|
6
|
|
|
|
|
30
|
return $permission;
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1;
|