line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter::API::User; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
827
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
64
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
36
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
133
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
115
|
use Net::SecurityCenter::Utils qw(:all); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1102
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.311'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $common_template = { |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
id => { |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
allow => qr/^\d+$/, |
19
|
|
|
|
|
|
|
messages => { |
20
|
|
|
|
|
|
|
required => 'User ID is required', |
21
|
|
|
|
|
|
|
allow => 'Invalid User ID', |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
fields => { |
26
|
|
|
|
|
|
|
filter => \&sc_filter_array_to_string |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
# METHODS |
33
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub list { |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $tmpl = { |
40
|
0
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
41
|
|
|
|
|
|
|
org_id => { |
42
|
|
|
|
|
|
|
allow => qr/^\d+$/, |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
raw => {}, |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
48
|
0
|
|
|
|
|
|
my $raw = delete( $params->{'raw'} ); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $response = $self->client->get( '/user', $params ); |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
return if ( !$response ); |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if ($raw) { |
55
|
0
|
0
|
|
|
|
|
return wantarray ? @{$response} : $response; |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
return wantarray ? @{ sc_normalize_array($response) } : sc_normalize_array($response); |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get { |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $tmpl = { |
69
|
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
70
|
0
|
|
|
|
|
|
id => $common_template->{'id'}, |
71
|
|
|
|
|
|
|
raw => {}, |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
75
|
0
|
|
|
|
|
|
my $raw = delete( $params->{'raw'} ); |
76
|
0
|
|
|
|
|
|
my $user_id = delete( $params->{'id'} ); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $response = $self->client->get( "/user/$user_id", $params ); |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
return if ( !$response ); |
81
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
if ($raw) { |
83
|
0
|
|
|
|
|
|
return $response; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return sc_normalize_hash($response); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |