line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ArangoDB2::User; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
81
|
use strict; |
|
20
|
|
|
|
|
24
|
|
|
20
|
|
|
|
|
600
|
|
4
|
20
|
|
|
20
|
|
75
|
use warnings; |
|
20
|
|
|
|
|
21
|
|
|
20
|
|
|
|
|
473
|
|
5
|
|
|
|
|
|
|
|
6
|
20
|
|
|
|
|
1297
|
use base qw( |
7
|
|
|
|
|
|
|
ArangoDB2::Base |
8
|
20
|
|
|
20
|
|
63
|
); |
|
20
|
|
|
|
|
24
|
|
9
|
|
|
|
|
|
|
|
10
|
20
|
|
|
20
|
|
104
|
use Data::Dumper; |
|
20
|
|
|
|
|
32
|
|
|
20
|
|
|
|
|
826
|
|
11
|
20
|
|
|
20
|
|
82
|
use JSON::XS; |
|
20
|
|
|
|
|
32
|
|
|
20
|
|
|
|
|
12215
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $JSON = JSON::XS->new->utf8; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my @PARAMS = qw( |
16
|
|
|
|
|
|
|
active changePassword extra name passwd |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
############### |
22
|
|
|
|
|
|
|
# API METHODS # |
23
|
|
|
|
|
|
|
############### |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# create |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
# POST /_api/user |
28
|
|
|
|
|
|
|
sub create |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
31
|
|
|
|
|
|
|
# process request args |
32
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, \@PARAMS); |
33
|
|
|
|
|
|
|
# use name for user param |
34
|
0
|
|
|
|
|
|
$args->{user} = delete $args->{name}; |
35
|
|
|
|
|
|
|
# make request |
36
|
0
|
0
|
|
|
|
|
my $res = $self->arango->http->post( |
37
|
|
|
|
|
|
|
$self->api_path('user'), |
38
|
|
|
|
|
|
|
undef, |
39
|
|
|
|
|
|
|
$JSON->encode($args), |
40
|
|
|
|
|
|
|
) or return; |
41
|
|
|
|
|
|
|
# if request was success copy args to self |
42
|
0
|
|
|
|
|
|
$self->_build_self($res, \@PARAMS); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $self; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# delete |
48
|
|
|
|
|
|
|
# |
49
|
|
|
|
|
|
|
# DELETE /_api/user/{user} |
50
|
|
|
|
|
|
|
sub delete |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
53
|
|
|
|
|
|
|
# process request args |
54
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['name']); |
55
|
|
|
|
|
|
|
# make request |
56
|
0
|
0
|
|
|
|
|
return $self->arango->http->delete( |
57
|
|
|
|
|
|
|
$self->api_path('user', delete $args->{name}), |
58
|
|
|
|
|
|
|
) or return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# get |
62
|
|
|
|
|
|
|
# |
63
|
|
|
|
|
|
|
# GET /_api/user/{user} |
64
|
|
|
|
|
|
|
sub get |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
67
|
|
|
|
|
|
|
# process request args |
68
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['name']); |
69
|
|
|
|
|
|
|
# make request |
70
|
0
|
0
|
|
|
|
|
my $res = $self->arango->http->get( |
71
|
|
|
|
|
|
|
$self->api_path('user', delete $args->{name}), |
72
|
|
|
|
|
|
|
) or return; |
73
|
|
|
|
|
|
|
# copy param data from res to self |
74
|
0
|
|
|
|
|
|
$self->_build_self($res, \@PARAMS); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# patch |
80
|
|
|
|
|
|
|
# |
81
|
|
|
|
|
|
|
# PATCH /_api/user/{user} |
82
|
|
|
|
|
|
|
sub patch |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
85
|
|
|
|
|
|
|
# process request args |
86
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, \@PARAMS); |
87
|
|
|
|
|
|
|
# make request |
88
|
0
|
0
|
|
|
|
|
my $res = $self->arango->http->patch( |
89
|
|
|
|
|
|
|
$self->api_path('user', delete $args->{name}), |
90
|
|
|
|
|
|
|
undef, |
91
|
|
|
|
|
|
|
$JSON->encode($args), |
92
|
|
|
|
|
|
|
) or return; |
93
|
|
|
|
|
|
|
# if request was success copy args to self |
94
|
0
|
|
|
|
|
|
$self->_build_self($res, \@PARAMS); |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return $self; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# replace |
100
|
|
|
|
|
|
|
# |
101
|
|
|
|
|
|
|
# PUT /_api/user/{user} |
102
|
|
|
|
|
|
|
sub replace |
103
|
|
|
|
|
|
|
{ |
104
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
105
|
|
|
|
|
|
|
# process request args |
106
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, \@PARAMS); |
107
|
|
|
|
|
|
|
# make request |
108
|
0
|
0
|
|
|
|
|
my $res = $self->arango->http->put( |
109
|
|
|
|
|
|
|
$self->api_path('user', delete $args->{name}), |
110
|
|
|
|
|
|
|
undef, |
111
|
|
|
|
|
|
|
$JSON->encode($args), |
112
|
|
|
|
|
|
|
) or return; |
113
|
|
|
|
|
|
|
# if request was success copy args to self |
114
|
0
|
|
|
|
|
|
$self->_build_self($res, \@PARAMS); |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
return $self; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
#################### |
120
|
|
|
|
|
|
|
# PROPERTY METHODS # |
121
|
|
|
|
|
|
|
#################### |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
0
|
1
|
|
sub active { shift->_get_set_bool('active', @_) } |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
0
|
1
|
|
sub changePassword { shift->_get_set_bool('changePassword', @_) } |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
0
|
1
|
|
sub extra { shift->_get_set('extra', @_) } |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
0
|
1
|
|
sub passwd { shift->_get_set('passwd', @_) } |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
__END__ |