maleo-identity 0.0.28__py3-none-any.whl → 0.0.29__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.
Potentially problematic release.
This version of maleo-identity might be problematic. Click here for more details.
- maleo_identity/client/controllers/__init__.py +4 -2
- maleo_identity/client/controllers/http/organization.py +166 -31
- maleo_identity/client/controllers/http/user.py +170 -32
- maleo_identity/client/manager.py +25 -8
- maleo_identity/client/services/__init__.py +4 -2
- maleo_identity/client/services/organization.py +317 -81
- maleo_identity/client/services/user.py +342 -87
- maleo_identity/models/schemas/general/user.py +10 -0
- maleo_identity/models/transfers/parameters/client/organization.py +9 -2
- maleo_identity/models/transfers/parameters/client/organization_role.py +8 -8
- maleo_identity/models/transfers/parameters/client/user.py +13 -2
- maleo_identity/models/transfers/parameters/client/user_organization.py +12 -12
- maleo_identity/models/transfers/parameters/client/user_organization_role.py +8 -8
- maleo_identity/models/transfers/parameters/client/user_profile.py +4 -4
- maleo_identity/models/transfers/parameters/client/user_system_role.py +8 -8
- maleo_identity/models/transfers/parameters/service/organization.py +9 -2
- maleo_identity/models/transfers/parameters/service/organization_role.py +6 -6
- maleo_identity/models/transfers/parameters/service/user.py +13 -2
- maleo_identity/models/transfers/parameters/service/user_organization.py +8 -8
- maleo_identity/models/transfers/parameters/service/user_organization_role.py +6 -6
- maleo_identity/models/transfers/parameters/service/user_profile.py +4 -4
- maleo_identity/models/transfers/parameters/service/user_system_role.py +6 -6
- {maleo_identity-0.0.28.dist-info → maleo_identity-0.0.29.dist-info}/METADATA +3 -3
- {maleo_identity-0.0.28.dist-info → maleo_identity-0.0.29.dist-info}/RECORD +26 -26
- {maleo_identity-0.0.28.dist-info → maleo_identity-0.0.29.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.28.dist-info → maleo_identity-0.0.29.dist-info}/top_level.txt +0 -0
|
@@ -3,25 +3,45 @@ from maleo_foundation.managers.client.base import ClientService
|
|
|
3
3
|
from maleo_foundation.utils.exceptions import BaseExceptions
|
|
4
4
|
from maleo_identity.client.controllers import MaleoIdentityUserControllers
|
|
5
5
|
from maleo_identity.enums.general import MaleoIdentityGeneralEnums
|
|
6
|
-
from maleo_identity.models.transfers.parameters.general.user
|
|
7
|
-
|
|
8
|
-
from maleo_identity.models.transfers.parameters.general.
|
|
9
|
-
|
|
10
|
-
from maleo_identity.models.transfers.parameters.
|
|
11
|
-
|
|
12
|
-
from maleo_identity.models.transfers.parameters.
|
|
13
|
-
|
|
14
|
-
from maleo_identity.models.transfers.
|
|
15
|
-
|
|
16
|
-
from maleo_identity.models.transfers.
|
|
17
|
-
|
|
18
|
-
from maleo_identity.
|
|
19
|
-
|
|
20
|
-
from maleo_identity.
|
|
21
|
-
|
|
6
|
+
from maleo_identity.models.transfers.parameters.general.user \
|
|
7
|
+
import MaleoIdentityUserGeneralParametersTransfers
|
|
8
|
+
from maleo_identity.models.transfers.parameters.general.user_organization \
|
|
9
|
+
import MaleoIdentityUserOrganizationGeneralParametersTransfers
|
|
10
|
+
from maleo_identity.models.transfers.parameters.general.user_system_role \
|
|
11
|
+
import MaleoIdentityUserSystemRoleGeneralParametersTransfers
|
|
12
|
+
from maleo_identity.models.transfers.parameters.general.user_organization_role \
|
|
13
|
+
import MaleoIdentityUserOrganizationRoleGeneralParametersTransfers
|
|
14
|
+
from maleo_identity.models.transfers.parameters.client.user \
|
|
15
|
+
import MaleoIdentityUserClientParametersTransfers
|
|
16
|
+
from maleo_identity.models.transfers.parameters.client.user_organization \
|
|
17
|
+
import MaleoIdentityUserOrganizationClientParametersTransfers
|
|
18
|
+
from maleo_identity.models.transfers.parameters.client.user_system_role \
|
|
19
|
+
import MaleoIdentityUserSystemRoleClientParametersTransfers
|
|
20
|
+
from maleo_identity.models.transfers.parameters.client.user_organization_role \
|
|
21
|
+
import MaleoIdentityUserOrganizationRoleClientParametersTransfers
|
|
22
|
+
from maleo_identity.models.transfers.results.client.user \
|
|
23
|
+
import MaleoIdentityUserClientResultsTransfers
|
|
24
|
+
from maleo_identity.models.transfers.results.client.user_organization \
|
|
25
|
+
import MaleoIdentityUserOrganizationClientResultsTransfers
|
|
26
|
+
from maleo_identity.models.transfers.results.client.user_system_role \
|
|
27
|
+
import MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
28
|
+
from maleo_identity.models.transfers.results.client.user_organization_role \
|
|
29
|
+
import MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
30
|
+
from maleo_identity.types.results.client.user \
|
|
31
|
+
import MaleoIdentityUserClientResultsTypes
|
|
32
|
+
from maleo_identity.types.results.client.user_organization \
|
|
33
|
+
import MaleoIdentityUserOrganizationClientResultsTypes
|
|
34
|
+
from maleo_identity.types.results.client.user_system_role \
|
|
35
|
+
import MaleoIdentityUserSystemRoleClientResultsTypes
|
|
36
|
+
from maleo_identity.types.results.client.user_organization_role \
|
|
37
|
+
import MaleoIdentityUserOrganizationRoleClientResultsTypes
|
|
22
38
|
|
|
23
39
|
class MaleoIdentityUserClientService(ClientService):
|
|
24
|
-
def __init__(
|
|
40
|
+
def __init__(
|
|
41
|
+
self,
|
|
42
|
+
logger,
|
|
43
|
+
controllers:MaleoIdentityUserControllers
|
|
44
|
+
):
|
|
25
45
|
super().__init__(logger)
|
|
26
46
|
self._controllers = controllers
|
|
27
47
|
|
|
@@ -42,25 +62,49 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
42
62
|
)
|
|
43
63
|
async def _impl():
|
|
44
64
|
#* Validate chosen controller type
|
|
45
|
-
if not isinstance(
|
|
65
|
+
if not isinstance(
|
|
66
|
+
controller_type,
|
|
67
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
68
|
+
):
|
|
46
69
|
message = "Invalid controller type"
|
|
47
70
|
description = "The provided controller type did not exists"
|
|
48
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
71
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
72
|
+
message=message,
|
|
73
|
+
description=description
|
|
74
|
+
)
|
|
49
75
|
#* Retrieve users using chosen controller
|
|
50
76
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
51
|
-
controller_result =
|
|
77
|
+
controller_result = (
|
|
78
|
+
await self._controllers.http
|
|
79
|
+
.get_users(parameters=parameters)
|
|
80
|
+
)
|
|
52
81
|
else:
|
|
53
82
|
message = "Invalid controller type"
|
|
54
83
|
description = "The provided controller type has not been implemented"
|
|
55
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
84
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
85
|
+
message=message,
|
|
86
|
+
description=description
|
|
87
|
+
)
|
|
56
88
|
#* Return proper response
|
|
57
89
|
if not controller_result.success:
|
|
58
|
-
return
|
|
90
|
+
return (
|
|
91
|
+
MaleoIdentityUserClientResultsTransfers
|
|
92
|
+
.Fail
|
|
93
|
+
.model_validate(controller_result.content)
|
|
94
|
+
)
|
|
59
95
|
else:
|
|
60
96
|
if controller_result.content["data"] is None:
|
|
61
|
-
return
|
|
97
|
+
return (
|
|
98
|
+
MaleoIdentityUserClientResultsTransfers
|
|
99
|
+
.NoData
|
|
100
|
+
.model_validate(controller_result.content)
|
|
101
|
+
)
|
|
62
102
|
else:
|
|
63
|
-
return
|
|
103
|
+
return (
|
|
104
|
+
MaleoIdentityUserClientResultsTransfers
|
|
105
|
+
.MultipleData
|
|
106
|
+
.model_validate(controller_result.content)
|
|
107
|
+
)
|
|
64
108
|
return await _impl()
|
|
65
109
|
|
|
66
110
|
async def get_user(
|
|
@@ -76,22 +120,42 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
76
120
|
)
|
|
77
121
|
async def _impl():
|
|
78
122
|
#* Validate chosen controller type
|
|
79
|
-
if not isinstance(
|
|
123
|
+
if not isinstance(
|
|
124
|
+
controller_type,
|
|
125
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
126
|
+
):
|
|
80
127
|
message = "Invalid controller type"
|
|
81
128
|
description = "The provided controller type did not exists"
|
|
82
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
129
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
130
|
+
message=message,
|
|
131
|
+
description=description
|
|
132
|
+
)
|
|
83
133
|
#* Retrieve user using chosen controller
|
|
84
134
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
85
|
-
controller_result =
|
|
135
|
+
controller_result = (
|
|
136
|
+
await self._controllers.http
|
|
137
|
+
.get_user(parameters=parameters)
|
|
138
|
+
)
|
|
86
139
|
else:
|
|
87
140
|
message = "Invalid controller type"
|
|
88
141
|
description = "The provided controller type has not been implemented"
|
|
89
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
142
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
143
|
+
message=message,
|
|
144
|
+
description=description
|
|
145
|
+
)
|
|
90
146
|
#* Return proper response
|
|
91
147
|
if not controller_result.success:
|
|
92
|
-
return
|
|
148
|
+
return (
|
|
149
|
+
MaleoIdentityUserClientResultsTransfers
|
|
150
|
+
.Fail
|
|
151
|
+
.model_validate(controller_result.content)
|
|
152
|
+
)
|
|
93
153
|
else:
|
|
94
|
-
return
|
|
154
|
+
return (
|
|
155
|
+
MaleoIdentityUserClientResultsTransfers
|
|
156
|
+
.SingleData
|
|
157
|
+
.model_validate(controller_result.content)
|
|
158
|
+
)
|
|
95
159
|
return await _impl()
|
|
96
160
|
|
|
97
161
|
async def create(
|
|
@@ -107,22 +171,42 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
107
171
|
)
|
|
108
172
|
async def _impl():
|
|
109
173
|
#* Validate chosen controller type
|
|
110
|
-
if not isinstance(
|
|
174
|
+
if not isinstance(
|
|
175
|
+
controller_type,
|
|
176
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
177
|
+
):
|
|
111
178
|
message = "Invalid controller type"
|
|
112
179
|
description = "The provided controller type did not exists"
|
|
113
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
180
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
181
|
+
message=message,
|
|
182
|
+
description=description
|
|
183
|
+
)
|
|
114
184
|
#* Create a new user using chosen controller
|
|
115
185
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
116
|
-
controller_result =
|
|
186
|
+
controller_result = (
|
|
187
|
+
await self._controllers.http
|
|
188
|
+
.create(parameters=parameters)
|
|
189
|
+
)
|
|
117
190
|
else:
|
|
118
191
|
message = "Invalid controller type"
|
|
119
192
|
description = "The provided controller type has not been implemented"
|
|
120
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
193
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
194
|
+
message=message,
|
|
195
|
+
description=description
|
|
196
|
+
)
|
|
121
197
|
#* Return proper response
|
|
122
198
|
if not controller_result.success:
|
|
123
|
-
return
|
|
199
|
+
return (
|
|
200
|
+
MaleoIdentityUserClientResultsTransfers
|
|
201
|
+
.Fail
|
|
202
|
+
.model_validate(controller_result.content)
|
|
203
|
+
)
|
|
124
204
|
else:
|
|
125
|
-
return
|
|
205
|
+
return (
|
|
206
|
+
MaleoIdentityUserClientResultsTransfers
|
|
207
|
+
.SingleData
|
|
208
|
+
.model_validate(controller_result.content)
|
|
209
|
+
)
|
|
126
210
|
return await _impl()
|
|
127
211
|
|
|
128
212
|
async def update(
|
|
@@ -138,22 +222,42 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
138
222
|
)
|
|
139
223
|
async def _impl():
|
|
140
224
|
#* Validate chosen controller type
|
|
141
|
-
if not isinstance(
|
|
225
|
+
if not isinstance(
|
|
226
|
+
controller_type,
|
|
227
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
228
|
+
):
|
|
142
229
|
message = "Invalid controller type"
|
|
143
230
|
description = "The provided controller type did not exists"
|
|
144
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
231
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
232
|
+
message=message,
|
|
233
|
+
description=description
|
|
234
|
+
)
|
|
145
235
|
#* Update user's data using chosen controller
|
|
146
236
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
147
|
-
controller_result =
|
|
237
|
+
controller_result = (
|
|
238
|
+
await self._controllers.http
|
|
239
|
+
.update(parameters=parameters)
|
|
240
|
+
)
|
|
148
241
|
else:
|
|
149
242
|
message = "Invalid controller type"
|
|
150
243
|
description = "The provided controller type has not been implemented"
|
|
151
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
244
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
245
|
+
message=message,
|
|
246
|
+
description=description
|
|
247
|
+
)
|
|
152
248
|
#* Return proper response
|
|
153
249
|
if not controller_result.success:
|
|
154
|
-
return
|
|
250
|
+
return (
|
|
251
|
+
MaleoIdentityUserClientResultsTransfers
|
|
252
|
+
.Fail
|
|
253
|
+
.model_validate(controller_result.content)
|
|
254
|
+
)
|
|
155
255
|
else:
|
|
156
|
-
return
|
|
256
|
+
return (
|
|
257
|
+
MaleoIdentityUserClientResultsTransfers
|
|
258
|
+
.SingleData
|
|
259
|
+
.model_validate(controller_result.content)
|
|
260
|
+
)
|
|
157
261
|
return await _impl()
|
|
158
262
|
|
|
159
263
|
async def get_password(
|
|
@@ -169,22 +273,42 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
169
273
|
)
|
|
170
274
|
async def _impl():
|
|
171
275
|
#* Validate chosen controller type
|
|
172
|
-
if not isinstance(
|
|
276
|
+
if not isinstance(
|
|
277
|
+
controller_type,
|
|
278
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
279
|
+
):
|
|
173
280
|
message = "Invalid controller type"
|
|
174
281
|
description = "The provided controller type did not exists"
|
|
175
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
282
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
283
|
+
message=message,
|
|
284
|
+
description=description
|
|
285
|
+
)
|
|
176
286
|
#* Retrieve user's password using chosen controller
|
|
177
287
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
178
|
-
controller_result =
|
|
288
|
+
controller_result = (
|
|
289
|
+
await self._controllers.http
|
|
290
|
+
.get_password(parameters=parameters)
|
|
291
|
+
)
|
|
179
292
|
else:
|
|
180
293
|
message = "Invalid controller type"
|
|
181
294
|
description = "The provided controller type has not been implemented"
|
|
182
|
-
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
295
|
+
return MaleoIdentityUserClientResultsTransfers.Fail(
|
|
296
|
+
message=message,
|
|
297
|
+
description=description
|
|
298
|
+
)
|
|
183
299
|
#* Return proper response
|
|
184
300
|
if not controller_result.success:
|
|
185
|
-
return
|
|
301
|
+
return (
|
|
302
|
+
MaleoIdentityUserClientResultsTransfers
|
|
303
|
+
.Fail
|
|
304
|
+
.model_validate(controller_result.content)
|
|
305
|
+
)
|
|
186
306
|
else:
|
|
187
|
-
return
|
|
307
|
+
return (
|
|
308
|
+
MaleoIdentityUserClientResultsTransfers
|
|
309
|
+
.SinglePassword
|
|
310
|
+
.model_validate(controller_result.content)
|
|
311
|
+
)
|
|
188
312
|
return await _impl()
|
|
189
313
|
|
|
190
314
|
async def get_user_organizations(
|
|
@@ -200,25 +324,49 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
200
324
|
)
|
|
201
325
|
async def _impl():
|
|
202
326
|
#* Validate chosen controller type
|
|
203
|
-
if not isinstance(
|
|
327
|
+
if not isinstance(
|
|
328
|
+
controller_type,
|
|
329
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
330
|
+
):
|
|
204
331
|
message = "Invalid controller type"
|
|
205
332
|
description = "The provided controller type did not exists"
|
|
206
|
-
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
333
|
+
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
334
|
+
message=message,
|
|
335
|
+
description=description
|
|
336
|
+
)
|
|
207
337
|
#* Retrieve user's organizations using chosen controller
|
|
208
338
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
209
|
-
controller_result =
|
|
339
|
+
controller_result = (
|
|
340
|
+
await self._controllers.http
|
|
341
|
+
.get_user_organizations(parameters=parameters)
|
|
342
|
+
)
|
|
210
343
|
else:
|
|
211
344
|
message = "Invalid controller type"
|
|
212
345
|
description = "The provided controller type has not been implemented"
|
|
213
|
-
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
346
|
+
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
347
|
+
message=message,
|
|
348
|
+
description=description
|
|
349
|
+
)
|
|
214
350
|
#* Return proper response
|
|
215
351
|
if not controller_result.success:
|
|
216
|
-
return
|
|
352
|
+
return (
|
|
353
|
+
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
354
|
+
.Fail
|
|
355
|
+
.model_validate(controller_result.content)
|
|
356
|
+
)
|
|
217
357
|
else:
|
|
218
358
|
if controller_result.content["data"] is None:
|
|
219
|
-
return
|
|
359
|
+
return (
|
|
360
|
+
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
361
|
+
.NoData
|
|
362
|
+
.model_validate(controller_result.content)
|
|
363
|
+
)
|
|
220
364
|
else:
|
|
221
|
-
return
|
|
365
|
+
return (
|
|
366
|
+
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
367
|
+
.MultipleData.
|
|
368
|
+
model_validate(controller_result.content)
|
|
369
|
+
)
|
|
222
370
|
return await _impl()
|
|
223
371
|
|
|
224
372
|
async def get_user_organization(
|
|
@@ -234,22 +382,42 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
234
382
|
)
|
|
235
383
|
async def _impl():
|
|
236
384
|
#* Validate chosen controller type
|
|
237
|
-
if not isinstance(
|
|
385
|
+
if not isinstance(
|
|
386
|
+
controller_type,
|
|
387
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
388
|
+
):
|
|
238
389
|
message = "Invalid controller type"
|
|
239
390
|
description = "The provided controller type did not exists"
|
|
240
|
-
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
391
|
+
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
392
|
+
message=message,
|
|
393
|
+
description=description
|
|
394
|
+
)
|
|
241
395
|
#* Retrieve user's organization using chosen controller
|
|
242
396
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
243
|
-
controller_result =
|
|
397
|
+
controller_result = (
|
|
398
|
+
await self._controllers.http
|
|
399
|
+
.get_user_organization(parameters=parameters)
|
|
400
|
+
)
|
|
244
401
|
else:
|
|
245
402
|
message = "Invalid controller type"
|
|
246
403
|
description = "The provided controller type has not been implemented"
|
|
247
|
-
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
404
|
+
return MaleoIdentityUserOrganizationClientResultsTransfers.Fail(
|
|
405
|
+
message=message,
|
|
406
|
+
description=description
|
|
407
|
+
)
|
|
248
408
|
#* Return proper response
|
|
249
409
|
if not controller_result.success:
|
|
250
|
-
return
|
|
410
|
+
return (
|
|
411
|
+
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
412
|
+
.Fail
|
|
413
|
+
.model_validate(controller_result.content)
|
|
414
|
+
)
|
|
251
415
|
else:
|
|
252
|
-
return
|
|
416
|
+
return (
|
|
417
|
+
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
418
|
+
.SingleData
|
|
419
|
+
.model_validate(controller_result.content)
|
|
420
|
+
)
|
|
253
421
|
return await _impl()
|
|
254
422
|
|
|
255
423
|
async def get_user_system_roles(
|
|
@@ -265,25 +433,49 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
265
433
|
)
|
|
266
434
|
async def _impl():
|
|
267
435
|
#* Validate chosen controller type
|
|
268
|
-
if not isinstance(
|
|
436
|
+
if not isinstance(
|
|
437
|
+
controller_type,
|
|
438
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
439
|
+
):
|
|
269
440
|
message = "Invalid controller type"
|
|
270
441
|
description = "The provided controller type did not exists"
|
|
271
|
-
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
442
|
+
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
443
|
+
message=message,
|
|
444
|
+
description=description
|
|
445
|
+
)
|
|
272
446
|
#* Retrieve user's system roles using chosen controller
|
|
273
447
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
274
|
-
controller_result =
|
|
448
|
+
controller_result = (
|
|
449
|
+
await self._controllers.http
|
|
450
|
+
.get_user_system_roles(parameters=parameters)
|
|
451
|
+
)
|
|
275
452
|
else:
|
|
276
453
|
message = "Invalid controller type"
|
|
277
454
|
description = "The provided controller type has not been implemented"
|
|
278
|
-
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
455
|
+
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
456
|
+
message=message,
|
|
457
|
+
description=description
|
|
458
|
+
)
|
|
279
459
|
#* Return proper response
|
|
280
460
|
if not controller_result.success:
|
|
281
|
-
return
|
|
461
|
+
return (
|
|
462
|
+
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
463
|
+
.Fail
|
|
464
|
+
.model_validate(controller_result.content)
|
|
465
|
+
)
|
|
282
466
|
else:
|
|
283
467
|
if controller_result.content["data"] is None:
|
|
284
|
-
return
|
|
468
|
+
return (
|
|
469
|
+
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
470
|
+
.NoData
|
|
471
|
+
.model_validate(controller_result.content)
|
|
472
|
+
)
|
|
285
473
|
else:
|
|
286
|
-
return
|
|
474
|
+
return (
|
|
475
|
+
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
476
|
+
.MultipleData
|
|
477
|
+
.model_validate(controller_result.content)
|
|
478
|
+
)
|
|
287
479
|
return await _impl()
|
|
288
480
|
|
|
289
481
|
async def get_user_system_role(
|
|
@@ -299,22 +491,41 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
299
491
|
)
|
|
300
492
|
async def _impl():
|
|
301
493
|
#* Validate chosen controller type
|
|
302
|
-
if not isinstance(
|
|
494
|
+
if not isinstance(
|
|
495
|
+
controller_type,
|
|
496
|
+
MaleoIdentityGeneralEnums.ClientControllerType):
|
|
303
497
|
message = "Invalid controller type"
|
|
304
498
|
description = "The provided controller type did not exists"
|
|
305
|
-
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
499
|
+
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
500
|
+
message=message,
|
|
501
|
+
description=description
|
|
502
|
+
)
|
|
306
503
|
#* Retrieve user's system role using chosen controller
|
|
307
504
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
308
|
-
controller_result =
|
|
505
|
+
controller_result = (
|
|
506
|
+
await self._controllers.http
|
|
507
|
+
.get_user_system_role(parameters=parameters)
|
|
508
|
+
)
|
|
309
509
|
else:
|
|
310
510
|
message = "Invalid controller type"
|
|
311
511
|
description = "The provided controller type has not been implemented"
|
|
312
|
-
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
512
|
+
return MaleoIdentityUserSystemRoleClientResultsTransfers.Fail(
|
|
513
|
+
message=message,
|
|
514
|
+
description=description
|
|
515
|
+
)
|
|
313
516
|
#* Return proper response
|
|
314
517
|
if not controller_result.success:
|
|
315
|
-
return
|
|
518
|
+
return (
|
|
519
|
+
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
520
|
+
.Fail
|
|
521
|
+
.model_validate(controller_result.content)
|
|
522
|
+
)
|
|
316
523
|
else:
|
|
317
|
-
return
|
|
524
|
+
return (
|
|
525
|
+
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
526
|
+
.SingleData
|
|
527
|
+
.model_validate(controller_result.content)
|
|
528
|
+
)
|
|
318
529
|
return await _impl()
|
|
319
530
|
|
|
320
531
|
async def get_user_organization_roles(
|
|
@@ -330,25 +541,49 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
330
541
|
)
|
|
331
542
|
async def _impl():
|
|
332
543
|
#* Validate chosen controller type
|
|
333
|
-
if not isinstance(
|
|
544
|
+
if not isinstance(
|
|
545
|
+
controller_type,
|
|
546
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
547
|
+
):
|
|
334
548
|
message = "Invalid controller type"
|
|
335
549
|
description = "The provided controller type did not exists"
|
|
336
|
-
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
550
|
+
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
551
|
+
message=message,
|
|
552
|
+
description=description
|
|
553
|
+
)
|
|
337
554
|
#* Retrieve user's organization roles using chosen controller
|
|
338
555
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
339
|
-
controller_result =
|
|
556
|
+
controller_result = (
|
|
557
|
+
await self._controllers.http
|
|
558
|
+
.get_user_organization_roles(parameters=parameters)
|
|
559
|
+
)
|
|
340
560
|
else:
|
|
341
561
|
message = "Invalid controller type"
|
|
342
562
|
description = "The provided controller type has not been implemented"
|
|
343
|
-
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
563
|
+
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
564
|
+
message=message,
|
|
565
|
+
description=description
|
|
566
|
+
)
|
|
344
567
|
#* Return proper response
|
|
345
568
|
if not controller_result.success:
|
|
346
|
-
return
|
|
569
|
+
return (
|
|
570
|
+
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
571
|
+
.Fail
|
|
572
|
+
.model_validate(controller_result.content)
|
|
573
|
+
)
|
|
347
574
|
else:
|
|
348
575
|
if controller_result.content["data"] is None:
|
|
349
|
-
return
|
|
576
|
+
return (
|
|
577
|
+
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
578
|
+
.NoData
|
|
579
|
+
.model_validate(controller_result.content)
|
|
580
|
+
)
|
|
350
581
|
else:
|
|
351
|
-
return
|
|
582
|
+
return (
|
|
583
|
+
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
584
|
+
.MultipleData
|
|
585
|
+
.model_validate(controller_result.content)
|
|
586
|
+
)
|
|
352
587
|
return await _impl()
|
|
353
588
|
|
|
354
589
|
async def get_user_organization_role(
|
|
@@ -364,20 +599,40 @@ class MaleoIdentityUserClientService(ClientService):
|
|
|
364
599
|
)
|
|
365
600
|
async def _impl():
|
|
366
601
|
#* Validate chosen controller type
|
|
367
|
-
if not isinstance(
|
|
602
|
+
if not isinstance(
|
|
603
|
+
controller_type,
|
|
604
|
+
MaleoIdentityGeneralEnums.ClientControllerType
|
|
605
|
+
):
|
|
368
606
|
message = "Invalid controller type"
|
|
369
607
|
description = "The provided controller type did not exists"
|
|
370
|
-
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
608
|
+
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
609
|
+
message=message,
|
|
610
|
+
description=description
|
|
611
|
+
)
|
|
371
612
|
#* Retrieve user's organization role using chosen controller
|
|
372
613
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
373
|
-
controller_result =
|
|
614
|
+
controller_result = (
|
|
615
|
+
await self._controllers.http
|
|
616
|
+
.get_user_organization_role(parameters=parameters)
|
|
617
|
+
)
|
|
374
618
|
else:
|
|
375
619
|
message = "Invalid controller type"
|
|
376
620
|
description = "The provided controller type has not been implemented"
|
|
377
|
-
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
621
|
+
return MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail(
|
|
622
|
+
message=message,
|
|
623
|
+
description=description
|
|
624
|
+
)
|
|
378
625
|
#* Return proper response
|
|
379
626
|
if not controller_result.success:
|
|
380
|
-
return
|
|
627
|
+
return (
|
|
628
|
+
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
629
|
+
.Fail
|
|
630
|
+
.model_validate(controller_result.content)
|
|
631
|
+
)
|
|
381
632
|
else:
|
|
382
|
-
return
|
|
633
|
+
return (
|
|
634
|
+
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
635
|
+
.SingleData
|
|
636
|
+
.model_validate(controller_result.content)
|
|
637
|
+
)
|
|
383
638
|
return await _impl()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
2
|
from typing import Optional, List
|
|
3
|
+
from maleo_foundation.types import BaseTypes
|
|
3
4
|
from maleo_identity.enums.user import MaleoIdentityUserEnums
|
|
4
5
|
|
|
5
6
|
class MaleoIdentityUserGeneralSchemas:
|
|
@@ -12,11 +13,20 @@ class MaleoIdentityUserGeneralSchemas:
|
|
|
12
13
|
class Username(BaseModel):
|
|
13
14
|
username:str = Field(..., max_length=50, description="User's username")
|
|
14
15
|
|
|
16
|
+
class Usernames(BaseModel):
|
|
17
|
+
usernames:BaseTypes.OptionalListOfStrings = Field(None, description="Specific usernames")
|
|
18
|
+
|
|
15
19
|
class Email(BaseModel):
|
|
16
20
|
email:str = Field(..., max_length=255, description="User's email")
|
|
17
21
|
|
|
22
|
+
class Emails(BaseModel):
|
|
23
|
+
emails:BaseTypes.OptionalListOfStrings = Field(None, description="Specific emails")
|
|
24
|
+
|
|
18
25
|
class Phone(BaseModel):
|
|
19
26
|
phone:str = Field(..., max_length=15, description="User's username")
|
|
20
27
|
|
|
28
|
+
class Phones(BaseModel):
|
|
29
|
+
phones:BaseTypes.OptionalListOfStrings = Field(None, description="Specific phones")
|
|
30
|
+
|
|
21
31
|
class Password(BaseModel):
|
|
22
32
|
password:str = Field(..., max_length=255, description="User's password")
|