line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crashplan::Client::User; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
39
|
use strict; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
240
|
|
4
|
8
|
|
|
8
|
|
37
|
use warnings; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
170
|
|
5
|
8
|
|
|
8
|
|
44
|
use JSON; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
39
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.003_0'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Crashplan::Client::User - Object representation of Crashplan PROe server's entity |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Crashplan::Client::User objects are instancied by Crashplan::Client. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Specifically, calling Crashplan::Client->parse_response after querying |
18
|
|
|
|
|
|
|
the server could produce Crashplan::Client::User |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
A user represents a distinct entity which uses the CrashPlan PRO Server for |
23
|
|
|
|
|
|
|
backups. Every user is a member of exactly one org. Users may also contain one |
24
|
|
|
|
|
|
|
or more computers. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 new |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The Crashplan::Client::User constructor |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
7
|
|
|
7
|
1
|
11
|
my $class = shift; |
37
|
7
|
|
50
|
|
|
16
|
my $param = shift || {}; |
38
|
|
|
|
|
|
|
|
39
|
7
|
|
|
|
|
17
|
my %converted_name = ( |
40
|
|
|
|
|
|
|
quotaBytes => 'quota.bytes', |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
8
|
my $self = $param; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
7
|
|
|
|
|
25
|
return bless $param,'Crashplan::Client::User'; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 id |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Getter for the 'id" attribute. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub id { |
57
|
7
|
|
|
7
|
1
|
64678
|
my $self = shift; |
58
|
|
|
|
|
|
|
|
59
|
7
|
|
|
|
|
20
|
return $self->{id}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 creationDate |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Getter for the 'creationDate" attribute. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub creationDate { |
69
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
5
|
return $self->{creationDate}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 modificationDate |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Getter for the 'modificationDate" attribute. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub modificationDate { |
81
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
6
|
return $self->{modificationDate}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 firstName |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
First name of the user |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub firstName { |
93
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
94
|
1
|
|
|
|
|
3
|
my $val = shift; |
95
|
|
|
|
|
|
|
|
96
|
1
|
50
|
|
|
|
8
|
if ($val) { |
97
|
0
|
|
|
|
|
0
|
$self->{'firstName'} = $val; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
1
|
|
|
|
|
6
|
return $self->{firstName}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 archiveBytesDeltaMonth |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Change in the number of bytes stored in the user'sarchive(s) over a month |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub archiveBytesDeltaMonth { |
111
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
112
|
0
|
|
|
|
|
0
|
my $val = shift; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
0
|
return $self->{archiveBytesDeltaMonth}; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 archiveBytesDelta |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Change in the number of bytes stored in the user'sarchive(s) |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub archiveBytesDelta { |
125
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
126
|
0
|
|
|
|
|
0
|
my $val = shift; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
0
|
return $self->{archiveBytesDelta}; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 status |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
“Active” if the user is currently active, “Deactivated” if the user has beendeactivated |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub status { |
139
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
140
|
1
|
|
|
|
|
3
|
my $val = shift; |
141
|
|
|
|
|
|
|
|
142
|
1
|
50
|
|
|
|
7
|
if ($val) { |
143
|
0
|
|
|
|
|
0
|
$self->{'status'} = $val; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
1
|
|
|
|
|
7
|
return $self->{status}; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 quotaBytes |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Configured size quota for this org (in gigabytes) |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub quotaBytes { |
156
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
157
|
0
|
|
|
|
|
0
|
my $val = shift; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
0
|
return $self->{quotaBytes}; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 dailyChange |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
? |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub dailyChange { |
170
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
171
|
0
|
|
|
|
|
0
|
my $val = shift; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
0
|
return $self->{dailyChange}; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 selectedBytes |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Byte count for all files selected for backup |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub selectedBytes { |
184
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
185
|
0
|
|
|
|
|
0
|
my $val = shift; |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
188
|
0
|
|
|
|
|
0
|
return $self->{selectedBytes}; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 username |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Used for user creation |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=cut |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub username { |
198
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
199
|
0
|
|
|
|
|
0
|
my $val = shift; |
200
|
|
|
|
|
|
|
|
201
|
0
|
0
|
|
|
|
0
|
if ($val) { |
202
|
0
|
|
|
|
|
0
|
$self->{'username'} = $val; |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
0
|
return $self->{username}; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 todoFiles |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Count of all files waiting to be backed up |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=cut |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
sub todoFiles { |
215
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
216
|
0
|
|
|
|
|
0
|
my $val = shift; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
0
|
return $self->{todoFiles}; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 email |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Email address of the user |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub email { |
229
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
230
|
1
|
|
|
|
|
2
|
my $val = shift; |
231
|
|
|
|
|
|
|
|
232
|
1
|
50
|
|
|
|
105
|
if ($val) { |
233
|
0
|
|
|
|
|
0
|
$self->{'email'} = $val; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
1
|
|
|
|
|
6
|
return $self->{email}; |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 archiveBytes |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Number of bytes stored in the user's archive(s) |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub archiveBytes { |
246
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
247
|
0
|
|
|
|
|
0
|
my $val = shift; |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
0
|
return $self->{archiveBytes}; |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head2 lastName |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Last name of the user |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=cut |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub lastName { |
260
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
261
|
1
|
|
|
|
|
3
|
my $val = shift; |
262
|
|
|
|
|
|
|
|
263
|
1
|
50
|
|
|
|
5
|
if ($val) { |
264
|
0
|
|
|
|
|
0
|
$self->{'lastName'} = $val; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
1
|
|
|
|
|
5
|
return $self->{lastName}; |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head2 orgId |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
The id of the org to which this user belongs |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=cut |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub orgId { |
277
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
278
|
1
|
|
|
|
|
3
|
my $val = shift; |
279
|
|
|
|
|
|
|
|
280
|
1
|
50
|
|
|
|
4
|
if ($val) { |
281
|
0
|
|
|
|
|
0
|
$self->{'orgId'} = $val; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
1
|
|
|
|
|
5
|
return $self->{orgId}; |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head2 selectedFiles |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
Count of all files selected for backup |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=cut |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
sub selectedFiles { |
294
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
295
|
0
|
|
|
|
|
|
my $val = shift; |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
return $self->{selectedFiles}; |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head2 todoBytes |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Byte count for all files waiting to be backed up |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub todoBytes { |
308
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
309
|
0
|
|
|
|
|
|
my $val = shift; |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
|
312
|
0
|
|
|
|
|
|
return $self->{todoBytes}; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head2 update |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Update an User entry in the database |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub update { |
322
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
323
|
|
|
|
|
|
|
#my @attributes = qw/name status parentId masterGuid registrationKey/; |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
# Filter out non REST attribute from the current object |
326
|
0
|
|
|
|
|
|
my @attributes = grep {!/^rest|rest_header$/} keys %$self; |
|
0
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
|
328
|
0
|
|
|
|
|
|
my $body = encode_json( { map {$_ => $self->{$_}} @attributes} ); |
|
0
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
$self->{rest}->PUT($self->url."/".$self->id,$body); |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=head2 url |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Getter for the 'url" to access the REST server |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=cut |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
sub url { |
340
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
341
|
|
|
|
|
|
|
|
342
|
0
|
|
|
|
|
|
return '/rest/users'; |
343
|
|
|
|
|
|
|
} |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=head1 SEE ALSO |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
http://support.crashplanpro.com/doku.php/api#user |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head1 AUTHOR |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Arnaud (Arhuman) Assad, copyright 2011 Jaguar Network |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=head1 LICENSE |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
This library is free software . You can redistribute it and/or modify |
356
|
|
|
|
|
|
|
it under the same terms as perl itself. |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=cut |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
1; |