zou 0.20.73__py3-none-any.whl → 0.20.75__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,10 +37,6 @@ from zou.app.services.auth_service import (
37
37
 
38
38
 
39
39
  class DesktopLoginsResource(Resource, ArgsMixin):
40
- """
41
- Allow to create and retrieve desktop login logs. Desktop login logs can only
42
- be created by current user.
43
- """
44
40
 
45
41
  @jwt_required()
46
42
  def get(self, person_id):
@@ -48,18 +44,37 @@ class DesktopLoginsResource(Resource, ArgsMixin):
48
44
  Retrieve desktop login logs.
49
45
  ---
50
46
  tags:
51
- - Persons
47
+ - Persons
52
48
  description: Desktop login logs can only be created by current user.
53
49
  parameters:
54
50
  - in: path
55
51
  name: person_id
56
- required: True
57
- type: string
58
- format: uuid
52
+ required: true
53
+ schema:
54
+ type: string
55
+ format: uuid
59
56
  example: a24a6ea4-ce75-4665-a070-57453082c25
60
57
  responses:
61
- 200:
62
- description: Desktop login logs
58
+ '200':
59
+ description: Desktop login logs
60
+ content:
61
+ application/json:
62
+ schema:
63
+ type: array
64
+ items:
65
+ type: object
66
+ properties:
67
+ id:
68
+ type: string
69
+ format: uuid
70
+ person_id:
71
+ type: string
72
+ format: uuid
73
+ date:
74
+ type: string
75
+ format: date-time
76
+ '404':
77
+ description: Person not found
63
78
  """
64
79
  current_user = persons_service.get_current_user()
65
80
  if (
@@ -77,24 +92,50 @@ class DesktopLoginsResource(Resource, ArgsMixin):
77
92
  Create desktop login logs.
78
93
  ---
79
94
  tags:
80
- - Persons
95
+ - Persons
81
96
  description: Add a new log entry for desktop logins.
82
97
  parameters:
83
98
  - in: path
84
99
  name: person_id
85
- required: True
86
- type: string
87
- format: uuid
100
+ required: true
101
+ schema:
102
+ type: string
103
+ format: uuid
88
104
  example: a24a6ea4-ce75-4665-a070-57453082c25
89
- - in: formData
90
- name: date
91
- required: True
92
- type: string
93
- format: date
94
- example: "2022-07-12"
105
+ requestBody:
106
+ required: true
107
+ content:
108
+ application/x-www-form-urlencoded:
109
+ schema:
110
+ type: object
111
+ required:
112
+ - date
113
+ properties:
114
+ date:
115
+ type: string
116
+ format: date
117
+ example: "2022-07-12"
95
118
  responses:
96
- 201:
97
- description: Desktop login log entry created.
119
+ '201':
120
+ description: Desktop login log entry created
121
+ content:
122
+ application/json:
123
+ schema:
124
+ type: object
125
+ properties:
126
+ id:
127
+ type: string
128
+ format: uuid
129
+ person_id:
130
+ type: string
131
+ format: uuid
132
+ date:
133
+ type: string
134
+ format: date-time
135
+ '400':
136
+ description: Invalid date format
137
+ '404':
138
+ description: Person not found
98
139
  """
99
140
  args = self.get_args([("date", date_helpers.get_utc_now_datetime())])
100
141
 
@@ -113,9 +154,6 @@ class DesktopLoginsResource(Resource, ArgsMixin):
113
154
 
114
155
 
115
156
  class PresenceLogsResource(Resource):
116
- """
117
- Return a csv file containing the presence logs based on a daily basis.
118
- """
119
157
 
120
158
  @jwt_required()
121
159
  def get(self, month_date):
@@ -123,17 +161,25 @@ class PresenceLogsResource(Resource):
123
161
  Return a csv file containing the presence logs based on a daily basis.
124
162
  ---
125
163
  tags:
126
- - Persons
164
+ - Persons
127
165
  parameters:
128
166
  - in: path
129
167
  name: month_date
130
- required: True
131
- type: string
132
- format: date
168
+ required: true
169
+ schema:
170
+ type: string
171
+ format: date
133
172
  example: "2022-07"
134
173
  responses:
135
- 200:
136
- description: CSV file containing the presence logs based on a daily basis
174
+ '200':
175
+ description: CSV file containing the presence logs based on a daily basis
176
+ content:
177
+ text/csv:
178
+ schema:
179
+ type: string
180
+ format: binary
181
+ '400':
182
+ description: Invalid date format
137
183
  """
138
184
  permissions.check_admin_permissions()
139
185
  date = datetime.datetime.strptime(month_date, "%Y-%m")
@@ -144,13 +190,64 @@ class PresenceLogsResource(Resource):
144
190
 
145
191
 
146
192
  class TimeSpentsResource(Resource, ArgsMixin):
147
- """
148
- Get all time spents for the given person.
149
- Optionnaly can accept date range parameters.
150
- """
151
193
 
152
194
  @jwt_required()
153
195
  def get(self, person_id):
196
+ """
197
+ Get all time spents for the given person.
198
+ Optionally can accept date range parameters.
199
+ ---
200
+ tags:
201
+ - Persons
202
+ parameters:
203
+ - in: path
204
+ name: person_id
205
+ required: true
206
+ schema:
207
+ type: string
208
+ format: uuid
209
+ example: a24a6ea4-ce75-4665-a070-57453082c25
210
+ - in: query
211
+ name: start_date
212
+ required: false
213
+ schema:
214
+ type: string
215
+ format: date
216
+ example: "2022-07-01"
217
+ - in: query
218
+ name: end_date
219
+ required: false
220
+ schema:
221
+ type: string
222
+ format: date
223
+ example: "2022-07-31"
224
+ responses:
225
+ '200':
226
+ description: All time spents for the given person
227
+ content:
228
+ application/json:
229
+ schema:
230
+ type: array
231
+ items:
232
+ type: object
233
+ properties:
234
+ id:
235
+ type: string
236
+ format: uuid
237
+ person_id:
238
+ type: string
239
+ format: uuid
240
+ duration:
241
+ type: number
242
+ format: float
243
+ date:
244
+ type: string
245
+ format: date
246
+ '400':
247
+ description: Invalid date range parameters
248
+ '404':
249
+ description: Person not found
250
+ """
154
251
  user_service.check_person_is_not_bot(person_id)
155
252
  permissions.check_admin_permissions()
156
253
  arguments = self.get_args(["start_date", "end_date"])
@@ -177,9 +274,6 @@ class TimeSpentsResource(Resource, ArgsMixin):
177
274
 
178
275
 
179
276
  class DateTimeSpentsResource(Resource):
180
- """
181
- Get time spents for given person and date.
182
- """
183
277
 
184
278
  @jwt_required()
185
279
  def get(self, person_id, date):
@@ -187,25 +281,48 @@ class DateTimeSpentsResource(Resource):
187
281
  Get time spents for given person and date.
188
282
  ---
189
283
  tags:
190
- - Persons
284
+ - Persons
191
285
  parameters:
192
286
  - in: path
193
287
  name: person_id
194
- required: True
195
- type: string
196
- format: uuid
288
+ required: true
289
+ schema:
290
+ type: string
291
+ format: uuid
197
292
  example: a24a6ea4-ce75-4665-a070-57453082c25
198
293
  - in: path
199
294
  name: date
200
- required: True
201
- type: string
202
- format: date
295
+ required: true
296
+ schema:
297
+ type: string
298
+ format: date
203
299
  example: "2022-07-12"
204
300
  responses:
205
- 200:
206
- description: Time spents for given person and date
207
- 404:
208
- description: Wrong date format
301
+ '200':
302
+ description: Time spents for given person and date
303
+ content:
304
+ application/json:
305
+ schema:
306
+ type: array
307
+ items:
308
+ type: object
309
+ properties:
310
+ id:
311
+ type: string
312
+ format: uuid
313
+ person_id:
314
+ type: string
315
+ format: uuid
316
+ duration:
317
+ type: number
318
+ format: float
319
+ date:
320
+ type: string
321
+ format: date
322
+ '400':
323
+ description: Wrong date format
324
+ '404':
325
+ description: Person not found
209
326
  """
210
327
  user_service.check_person_is_not_bot(person_id)
211
328
  department_ids = None
@@ -238,9 +355,6 @@ class DateTimeSpentsResource(Resource):
238
355
 
239
356
 
240
357
  class DayOffResource(Resource):
241
- """
242
- Get day off object for given person and date.
243
- """
244
358
 
245
359
  @jwt_required()
246
360
  def get(self, person_id, date):
@@ -248,25 +362,45 @@ class DayOffResource(Resource):
248
362
  Get day off object for given person and date.
249
363
  ---
250
364
  tags:
251
- - Persons
365
+ - Persons
252
366
  parameters:
253
367
  - in: path
254
368
  name: person_id
255
- required: True
256
- type: string
257
- format: uuid
369
+ required: true
370
+ schema:
371
+ type: string
372
+ format: uuid
258
373
  example: a24a6ea4-ce75-4665-a070-57453082c25
259
374
  - in: path
260
375
  name: date
261
- required: True
262
- type: string
263
- format: date
376
+ required: true
377
+ schema:
378
+ type: string
379
+ format: date
264
380
  example: "2022-07-12"
265
381
  responses:
266
- 200:
267
- description: Day off object for given person and date
268
- 404:
269
- description: Wrong date format
382
+ '200':
383
+ description: Day off object for given person and date
384
+ content:
385
+ application/json:
386
+ schema:
387
+ type: object
388
+ properties:
389
+ id:
390
+ type: string
391
+ format: uuid
392
+ person_id:
393
+ type: string
394
+ format: uuid
395
+ date:
396
+ type: string
397
+ format: date
398
+ type:
399
+ type: string
400
+ '400':
401
+ description: Wrong date format
402
+ '404':
403
+ description: Person not found
270
404
  """
271
405
  user_service.check_person_is_not_bot(person_id)
272
406
  current_user = persons_service.get_current_user()
@@ -282,9 +416,6 @@ class DayOffResource(Resource):
282
416
 
283
417
 
284
418
  class PersonDurationTimeSpentsResource(Resource, ArgsMixin):
285
- """
286
- Parent class for all person durations time spents resource.
287
- """
288
419
 
289
420
  def get_project_department_arguments(self, person_id):
290
421
  project_id = self.get_project_id()
@@ -317,9 +448,6 @@ class PersonDurationTimeSpentsResource(Resource, ArgsMixin):
317
448
 
318
449
 
319
450
  class PersonYearTimeSpentsResource(PersonDurationTimeSpentsResource):
320
- """
321
- Get aggregated time spents for given person and year.
322
- """
323
451
 
324
452
  @jwt_required()
325
453
  def get(self, person_id, year):
@@ -327,24 +455,38 @@ class PersonYearTimeSpentsResource(PersonDurationTimeSpentsResource):
327
455
  Get aggregated time spents for given person and year.
328
456
  ---
329
457
  tags:
330
- - Persons
458
+ - Persons
331
459
  parameters:
332
460
  - in: path
333
461
  name: person_id
334
- required: True
335
- type: string
336
- format: uuid
462
+ required: true
463
+ schema:
464
+ type: string
465
+ format: uuid
337
466
  example: a24a6ea4-ce75-4665-a070-57453082c25
338
467
  - in: path
339
468
  name: year
340
- required: True
341
- type: integer
342
- example: "2022"
469
+ required: true
470
+ schema:
471
+ type: integer
472
+ example: 2022
343
473
  responses:
344
- 200:
345
- description: Aggregated time spents for given person and year
346
- 404:
347
- description: Wrong date format
474
+ '200':
475
+ description: Aggregated time spents for given person and year
476
+ content:
477
+ application/json:
478
+ schema:
479
+ type: object
480
+ properties:
481
+ total_duration:
482
+ type: number
483
+ format: float
484
+ year:
485
+ type: integer
486
+ '400':
487
+ description: Wrong date format
488
+ '404':
489
+ description: Person not found
348
490
  """
349
491
  user_service.check_person_is_not_bot(person_id)
350
492
  try:
@@ -358,9 +500,6 @@ class PersonYearTimeSpentsResource(PersonDurationTimeSpentsResource):
358
500
 
359
501
 
360
502
  class PersonMonthTimeSpentsResource(PersonDurationTimeSpentsResource):
361
- """
362
- Get aggregated time spents for given person and month.
363
- """
364
503
 
365
504
  @jwt_required()
366
505
  def get(self, person_id, year, month):
@@ -407,12 +546,12 @@ class PersonMonthTimeSpentsResource(PersonDurationTimeSpentsResource):
407
546
 
408
547
 
409
548
  class PersonMonthAllTimeSpentsResource(Resource):
410
- """
411
- Get all time spents for a given person and month.
412
- """
413
549
 
414
550
  @jwt_required()
415
551
  def get(self, person_id, year, month):
552
+ """
553
+ Get all time spents for a given person and month.
554
+ """
416
555
  user_service.check_person_is_not_bot(person_id)
417
556
  user_service.check_person_access(person_id)
418
557
  try:
@@ -425,9 +564,6 @@ class PersonMonthAllTimeSpentsResource(Resource):
425
564
 
426
565
 
427
566
  class PersonWeekTimeSpentsResource(PersonDurationTimeSpentsResource):
428
- """
429
- Get aggregated time spents for given person and week.
430
- """
431
567
 
432
568
  @jwt_required()
433
569
  def get(self, person_id, year, week):
@@ -474,9 +610,6 @@ class PersonWeekTimeSpentsResource(PersonDurationTimeSpentsResource):
474
610
 
475
611
 
476
612
  class PersonDayTimeSpentsResource(PersonDurationTimeSpentsResource):
477
- """
478
- Get aggregated time spents for given person and day.
479
- """
480
613
 
481
614
  @jwt_required()
482
615
  def get(self, person_id, year, month, day):
@@ -578,9 +711,6 @@ class PersonQuotaMixin(ArgsMixin):
578
711
 
579
712
 
580
713
  class PersonMonthQuotaShotsResource(Resource, PersonQuotaMixin):
581
- """
582
- Get ended shots used for quota calculation of this month.
583
- """
584
714
 
585
715
  def get_person_quotas(self, person_id, year, month, **kwargs):
586
716
  return shots_service.get_month_quota_shots(
@@ -629,9 +759,6 @@ class PersonMonthQuotaShotsResource(Resource, PersonQuotaMixin):
629
759
 
630
760
 
631
761
  class PersonWeekQuotaShotsResource(Resource, PersonQuotaMixin):
632
- """
633
- Get ended shots used for quota calculation of this week.
634
- """
635
762
 
636
763
  def get_person_quotas(self, person_id, year, week, **kwargs):
637
764
  return shots_service.get_week_quota_shots(
@@ -680,9 +807,6 @@ class PersonWeekQuotaShotsResource(Resource, PersonQuotaMixin):
680
807
 
681
808
 
682
809
  class PersonDayQuotaShotsResource(Resource, PersonQuotaMixin):
683
- """
684
- Get ended shots used for quota calculation of this day.
685
- """
686
810
 
687
811
  def get_person_quotas(self, person_id, year, month, day, **kwargs):
688
812
  return shots_service.get_day_quota_shots(
@@ -786,10 +910,6 @@ class TimeSpentDurationResource(Resource, ArgsMixin):
786
910
 
787
911
 
788
912
  class TimeSpentMonthResource(TimeSpentDurationResource):
789
- """
790
- Return a table giving time spent by user and by day for given year and
791
- month.
792
- """
793
913
 
794
914
  @jwt_required()
795
915
  def get(self, year, month):
@@ -822,9 +942,6 @@ class TimeSpentMonthResource(TimeSpentDurationResource):
822
942
 
823
943
 
824
944
  class TimeSpentYearsResource(TimeSpentDurationResource):
825
- """
826
- Return a table giving time spent by user and by month for given year.
827
- """
828
945
 
829
946
  @jwt_required()
830
947
  def get(self):
@@ -843,9 +960,6 @@ class TimeSpentYearsResource(TimeSpentDurationResource):
843
960
 
844
961
 
845
962
  class TimeSpentMonthsResource(TimeSpentDurationResource):
846
- """
847
- Return a table giving time spent by user and by month for given year.
848
- """
849
963
 
850
964
  @jwt_required()
851
965
  def get(self, year):
@@ -870,9 +984,6 @@ class TimeSpentMonthsResource(TimeSpentDurationResource):
870
984
 
871
985
 
872
986
  class TimeSpentWeekResource(TimeSpentDurationResource):
873
- """
874
- Return a table giving time spent by user and by week for given year.
875
- """
876
987
 
877
988
  @jwt_required()
878
989
  def get(self, year):
@@ -897,9 +1008,6 @@ class TimeSpentWeekResource(TimeSpentDurationResource):
897
1008
 
898
1009
 
899
1010
  class InvitePersonResource(Resource):
900
- """
901
- Sends an email to given person to invite him/her to connect to Kitsu.
902
- """
903
1011
 
904
1012
  @jwt_required()
905
1013
  def get(self, person_id):
@@ -926,9 +1034,6 @@ class InvitePersonResource(Resource):
926
1034
 
927
1035
 
928
1036
  class DayOffForMonthResource(Resource, ArgsMixin):
929
- """
930
- Return all day off recorded for given month.
931
- """
932
1037
 
933
1038
  @jwt_required()
934
1039
  def get(self, year, month):
@@ -964,9 +1069,6 @@ class DayOffForMonthResource(Resource, ArgsMixin):
964
1069
 
965
1070
 
966
1071
  class PersonWeekDayOffResource(Resource, ArgsMixin):
967
- """
968
- Return all day off recorded for given week and person.
969
- """
970
1072
 
971
1073
  @jwt_required()
972
1074
  def get(self, person_id, year, week):
@@ -1006,9 +1108,6 @@ class PersonWeekDayOffResource(Resource, ArgsMixin):
1006
1108
 
1007
1109
 
1008
1110
  class PersonMonthDayOffResource(Resource, ArgsMixin):
1009
- """
1010
- Return all day off recorded for given month and person.
1011
- """
1012
1111
 
1013
1112
  @jwt_required()
1014
1113
  def get(self, person_id, year, month):
@@ -1048,9 +1147,6 @@ class PersonMonthDayOffResource(Resource, ArgsMixin):
1048
1147
 
1049
1148
 
1050
1149
  class PersonYearDayOffResource(Resource, ArgsMixin):
1051
- """
1052
- Return all day off recorded for given year and person.
1053
- """
1054
1150
 
1055
1151
  @jwt_required()
1056
1152
  def get(self, person_id, year):
@@ -1083,9 +1179,6 @@ class PersonYearDayOffResource(Resource, ArgsMixin):
1083
1179
 
1084
1180
 
1085
1181
  class PersonDayOffResource(Resource, ArgsMixin):
1086
- """
1087
- Return all day offs recorded for given and person.
1088
- """
1089
1182
 
1090
1183
  @jwt_required()
1091
1184
  def get(self, person_id):
@@ -1113,9 +1206,6 @@ class PersonDayOffResource(Resource, ArgsMixin):
1113
1206
 
1114
1207
 
1115
1208
  class AddToDepartmentResource(Resource, ArgsMixin):
1116
- """
1117
- Add a user to given department.
1118
- """
1119
1209
 
1120
1210
  @jwt_required()
1121
1211
  def post(self, person_id):
@@ -1123,17 +1213,46 @@ class AddToDepartmentResource(Resource, ArgsMixin):
1123
1213
  Add a user to given department.
1124
1214
  ---
1125
1215
  tags:
1126
- - Persons
1216
+ - Persons
1127
1217
  parameters:
1128
1218
  - in: path
1129
1219
  name: person_id
1130
- required: True
1131
- type: string
1132
- format: uuid
1220
+ required: true
1221
+ schema:
1222
+ type: string
1223
+ format: uuid
1133
1224
  example: a24a6ea4-ce75-4665-a070-57453082c25
1225
+ requestBody:
1226
+ required: true
1227
+ content:
1228
+ application/x-www-form-urlencoded:
1229
+ schema:
1230
+ type: object
1231
+ required:
1232
+ - department_id
1233
+ properties:
1234
+ department_id:
1235
+ type: string
1236
+ format: uuid
1237
+ example: a24a6ea4-ce75-4665-a070-57453082c25
1134
1238
  responses:
1135
- 201:
1136
- description: User added to given department
1239
+ '201':
1240
+ description: User added to given department
1241
+ content:
1242
+ application/json:
1243
+ schema:
1244
+ type: object
1245
+ properties:
1246
+ id:
1247
+ type: string
1248
+ format: uuid
1249
+ department_id:
1250
+ type: string
1251
+ format: uuid
1252
+ '400':
1253
+ description: Invalid department ID
1254
+ '404':
1255
+ description: Person or department not found
1137
1256
  """
1138
1257
  args = self.get_args(
1139
1258
  [
@@ -1154,9 +1273,6 @@ class AddToDepartmentResource(Resource, ArgsMixin):
1154
1273
 
1155
1274
 
1156
1275
  class RemoveFromDepartmentResource(Resource, ArgsMixin):
1157
- """
1158
- Remove a user from given department.
1159
- """
1160
1276
 
1161
1277
  @jwt_required()
1162
1278
  def delete(self, person_id, department_id):
@@ -1194,9 +1310,6 @@ class RemoveFromDepartmentResource(Resource, ArgsMixin):
1194
1310
 
1195
1311
 
1196
1312
  class ChangePasswordForPersonResource(Resource, ArgsMixin):
1197
- """
1198
- Allow admin to change password for given user.
1199
- """
1200
1313
 
1201
1314
  @jwt_required()
1202
1315
  def post(self, person_id):
@@ -1208,29 +1321,54 @@ class ChangePasswordForPersonResource(Resource, ArgsMixin):
1208
1321
  The new password requires a confirmation to ensure that the admin didn't
1209
1322
  make a mistake by typing the new password.
1210
1323
  tags:
1211
- - Persons
1324
+ - Persons
1212
1325
  parameters:
1213
1326
  - in: path
1214
1327
  name: person_id
1215
- required: True
1216
- type: string
1217
- format: uuid
1328
+ required: true
1329
+ schema:
1330
+ type: string
1331
+ format: uuid
1218
1332
  example: a24a6ea4-ce75-4665-a070-57453082c25
1219
- - in: formData
1220
- name: password
1221
- required: True
1222
- type: string
1223
- format: password
1224
- - in: formData
1225
- name: password_2
1226
- required: True
1227
- type: string
1228
- format: password
1333
+ requestBody:
1334
+ required: true
1335
+ content:
1336
+ application/x-www-form-urlencoded:
1337
+ schema:
1338
+ type: object
1339
+ required:
1340
+ - password
1341
+ - password_2
1342
+ properties:
1343
+ password:
1344
+ type: string
1345
+ format: password
1346
+ description: New password
1347
+ password_2:
1348
+ type: string
1349
+ format: password
1350
+ description: Password confirmation
1229
1351
  responses:
1230
- 200:
1352
+ '200':
1231
1353
  description: Password changed
1232
- 400:
1354
+ content:
1355
+ application/json:
1356
+ schema:
1357
+ type: object
1358
+ properties:
1359
+ success:
1360
+ type: boolean
1361
+ '400':
1233
1362
  description: Invalid password or inactive user
1363
+ content:
1364
+ application/json:
1365
+ schema:
1366
+ type: object
1367
+ properties:
1368
+ error:
1369
+ type: string
1370
+ '404':
1371
+ description: Person not found
1234
1372
  """
1235
1373
  user_service.check_person_is_not_bot(person_id)
1236
1374
  (password, password_2) = self.get_arguments()
@@ -1314,9 +1452,6 @@ Thank you and see you soon on Kitsu,
1314
1452
 
1315
1453
 
1316
1454
  class DisableTwoFactorAuthenticationPersonResource(Resource, ArgsMixin):
1317
- """
1318
- Allow admin to disable two factor authentication for given user.
1319
- """
1320
1455
 
1321
1456
  @jwt_required()
1322
1457
  def delete(self, person_id):