line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
16
|
use utf8; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
16
|
|
2
|
|
|
|
|
|
|
package Etcd3::Auth::UserGrantRole; |
3
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
137
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
69
|
|
5
|
4
|
|
|
4
|
|
13
|
use warnings; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
78
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
14
|
use Moo; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
15
|
|
8
|
4
|
|
|
4
|
|
820
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
19
|
|
9
|
4
|
|
|
4
|
|
2037
|
use MIME::Base64; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
155
|
|
10
|
4
|
|
|
4
|
|
12
|
use JSON; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
16
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
372
|
use namespace::clean; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
17
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Etcd3:::Auth::UserGrantRole |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Add role to user |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 endpoint |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has endpoint => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
isa => Str, |
35
|
|
|
|
|
|
|
default => '/auth/user/grant' |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 user |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
name of role |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has user => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => Str, |
47
|
|
|
|
|
|
|
required => 1, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 role |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
name of role |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has role => ( |
58
|
|
|
|
|
|
|
is => 'ro', |
59
|
|
|
|
|
|
|
isa => Str, |
60
|
|
|
|
|
|
|
required => 1, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 json_args |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
arguments that will be sent to the api |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has json_args => ( |
71
|
|
|
|
|
|
|
is => 'lazy', |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _build_json_args { |
75
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
76
|
0
|
|
|
|
|
|
my $args; |
77
|
0
|
|
|
|
|
|
for my $key ( keys %{ $self }) { |
|
0
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
unless ( $key =~ /(?:_client|json_args|endpoint)$/ ) { |
79
|
0
|
|
|
|
|
|
$args->{$key} = $self->{$key}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
0
|
|
|
|
|
|
return to_json($args); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 init |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub init { |
90
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
91
|
0
|
|
|
|
|
|
my $init = $self->json_args; |
92
|
0
|
0
|
|
|
|
|
$init or return; |
93
|
0
|
|
|
|
|
|
return $self; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |