maleo-identity 0.0.29__py3-none-any.whl → 0.0.32__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/services/organization.py +266 -23
- maleo_identity/client/services/user.py +293 -27
- maleo_identity/models/transfers/results/__init__.py +2 -2
- maleo_identity/models/transfers/results/repository/__init__.py +17 -0
- maleo_identity/models/transfers/results/repository/organization.py +19 -0
- maleo_identity/models/transfers/results/repository/organization_role.py +19 -0
- maleo_identity/models/transfers/results/repository/user.py +28 -0
- maleo_identity/models/transfers/results/repository/user_organization.py +19 -0
- maleo_identity/models/transfers/results/repository/user_organization_role.py +19 -0
- maleo_identity/models/transfers/results/repository/user_profile.py +19 -0
- maleo_identity/models/transfers/results/repository/user_system_role.py +19 -0
- maleo_identity/types/results/__init__.py +2 -2
- maleo_identity/types/results/repository/__init__.py +17 -0
- maleo_identity/types/results/repository/organization.py +20 -0
- maleo_identity/types/results/repository/organization_role.py +15 -0
- maleo_identity/types/results/repository/user.py +25 -0
- maleo_identity/types/results/repository/user_organization.py +20 -0
- maleo_identity/types/results/repository/user_organization_role.py +15 -0
- maleo_identity/types/results/repository/user_profile.py +20 -0
- maleo_identity/types/results/repository/user_system_role.py +20 -0
- {maleo_identity-0.0.29.dist-info → maleo_identity-0.0.32.dist-info}/METADATA +3 -3
- {maleo_identity-0.0.29.dist-info → maleo_identity-0.0.32.dist-info}/RECORD +24 -24
- maleo_identity/models/transfers/results/query/__init__.py +0 -17
- maleo_identity/models/transfers/results/query/organization.py +0 -19
- maleo_identity/models/transfers/results/query/organization_role.py +0 -19
- maleo_identity/models/transfers/results/query/user.py +0 -28
- maleo_identity/models/transfers/results/query/user_organization.py +0 -19
- maleo_identity/models/transfers/results/query/user_organization_role.py +0 -19
- maleo_identity/models/transfers/results/query/user_profile.py +0 -19
- maleo_identity/models/transfers/results/query/user_system_role.py +0 -19
- maleo_identity/types/results/query/__init__.py +0 -17
- maleo_identity/types/results/query/organization.py +0 -20
- maleo_identity/types/results/query/organization_role.py +0 -15
- maleo_identity/types/results/query/user.py +0 -25
- maleo_identity/types/results/query/user_organization.py +0 -20
- maleo_identity/types/results/query/user_organization_role.py +0 -15
- maleo_identity/types/results/query/user_profile.py +0 -20
- maleo_identity/types/results/query/user_system_role.py +0 -20
- {maleo_identity-0.0.29.dist-info → maleo_identity-0.0.32.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.29.dist-info → maleo_identity-0.0.32.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
from
|
|
1
|
+
from aiocache import cached, Cache
|
|
2
|
+
from aiocache.serializers import JsonSerializer
|
|
3
|
+
from maleo_foundation.enums import BaseEnums
|
|
4
|
+
from maleo_foundation.managers.cache.base import BaseCacheConfigurations
|
|
5
|
+
from maleo_foundation.managers.client.maleo import MaleoClientService
|
|
6
|
+
from maleo_foundation.utils.client import BaseClientUtils
|
|
2
7
|
from maleo_foundation.utils.exceptions import BaseExceptions
|
|
3
8
|
from maleo_identity.client.controllers import MaleoIdentityOrganizationControllers
|
|
4
9
|
from maleo_identity.enums.general import MaleoIdentityGeneralEnums
|
|
@@ -35,13 +40,15 @@ from maleo_identity.types.results.client.user_organization \
|
|
|
35
40
|
from maleo_identity.types.results.client.user_organization_role \
|
|
36
41
|
import MaleoIdentityUserOrganizationRoleClientResultsTypes
|
|
37
42
|
|
|
38
|
-
class MaleoIdentityOrganizationClientService(
|
|
43
|
+
class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
39
44
|
def __init__(
|
|
40
45
|
self,
|
|
46
|
+
key,
|
|
41
47
|
logger,
|
|
48
|
+
service_manager,
|
|
42
49
|
controllers:MaleoIdentityOrganizationControllers
|
|
43
50
|
):
|
|
44
|
-
super().__init__(logger)
|
|
51
|
+
super().__init__(key, logger, service_manager)
|
|
45
52
|
self._controllers = controllers
|
|
46
53
|
|
|
47
54
|
@property
|
|
@@ -59,7 +66,30 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
59
66
|
logger=self._logger,
|
|
60
67
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
61
68
|
)
|
|
62
|
-
|
|
69
|
+
@BaseClientUtils.result_processor(
|
|
70
|
+
fail_class=MaleoIdentityOrganizationClientResultsTransfers.Fail,
|
|
71
|
+
data_found_class=MaleoIdentityOrganizationClientResultsTransfers.MultipleData,
|
|
72
|
+
no_data_class=MaleoIdentityOrganizationClientResultsTransfers.NoData
|
|
73
|
+
)
|
|
74
|
+
@cached(
|
|
75
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
76
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
77
|
+
"organization",
|
|
78
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
79
|
+
base_override=self.key
|
|
80
|
+
),
|
|
81
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
82
|
+
cache=Cache.REDIS,
|
|
83
|
+
serializer=JsonSerializer(),
|
|
84
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
85
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
86
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
87
|
+
db=self.service_manager.configs.cache.redis.db
|
|
88
|
+
)
|
|
89
|
+
async def _impl(
|
|
90
|
+
parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultiple,
|
|
91
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
92
|
+
):
|
|
63
93
|
#* Validate chosen controller type
|
|
64
94
|
if not isinstance(
|
|
65
95
|
controller_type,
|
|
@@ -90,6 +120,7 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
90
120
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
91
121
|
.Fail
|
|
92
122
|
.model_validate(controller_result.content)
|
|
123
|
+
.model_dump(mode="json")
|
|
93
124
|
)
|
|
94
125
|
else:
|
|
95
126
|
if controller_result.content["data"] is None:
|
|
@@ -97,14 +128,19 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
97
128
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
98
129
|
.NoData
|
|
99
130
|
.model_validate(controller_result.content)
|
|
131
|
+
.model_dump(mode="json")
|
|
100
132
|
)
|
|
101
133
|
else:
|
|
102
134
|
return (
|
|
103
135
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
104
136
|
.MultipleData
|
|
105
137
|
.model_validate(controller_result.content)
|
|
138
|
+
.model_dump(mode="json")
|
|
106
139
|
)
|
|
107
|
-
return await _impl(
|
|
140
|
+
return await _impl(
|
|
141
|
+
parameters=parameters,
|
|
142
|
+
controller_type=controller_type
|
|
143
|
+
)
|
|
108
144
|
|
|
109
145
|
async def get_organization(
|
|
110
146
|
self,
|
|
@@ -117,7 +153,29 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
117
153
|
logger=self._logger,
|
|
118
154
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
119
155
|
)
|
|
120
|
-
|
|
156
|
+
@BaseClientUtils.result_processor(
|
|
157
|
+
fail_class=MaleoIdentityOrganizationClientResultsTransfers.Fail,
|
|
158
|
+
data_found_class=MaleoIdentityOrganizationClientResultsTransfers.SingleData
|
|
159
|
+
)
|
|
160
|
+
@cached(
|
|
161
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
162
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
163
|
+
"organization",
|
|
164
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
165
|
+
base_override=self.key
|
|
166
|
+
),
|
|
167
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
168
|
+
cache=Cache.REDIS,
|
|
169
|
+
serializer=JsonSerializer(),
|
|
170
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
171
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
172
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
173
|
+
db=self.service_manager.configs.cache.redis.db
|
|
174
|
+
)
|
|
175
|
+
async def _impl(
|
|
176
|
+
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
|
|
177
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
178
|
+
):
|
|
121
179
|
#* Validate chosen controller type
|
|
122
180
|
if not isinstance(
|
|
123
181
|
controller_type,
|
|
@@ -148,14 +206,19 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
148
206
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
149
207
|
.Fail
|
|
150
208
|
.model_validate(controller_result.content)
|
|
209
|
+
.model_dump(mode="json")
|
|
151
210
|
)
|
|
152
211
|
else:
|
|
153
212
|
return (
|
|
154
213
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
155
214
|
.SingleData
|
|
156
215
|
.model_validate(controller_result.content)
|
|
216
|
+
.model_dump(mode="json")
|
|
157
217
|
)
|
|
158
|
-
return await _impl(
|
|
218
|
+
return await _impl(
|
|
219
|
+
parameters=parameters,
|
|
220
|
+
controller_type=controller_type
|
|
221
|
+
)
|
|
159
222
|
|
|
160
223
|
async def create(
|
|
161
224
|
self,
|
|
@@ -168,7 +231,10 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
168
231
|
logger=self._logger,
|
|
169
232
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
170
233
|
)
|
|
171
|
-
async def _impl(
|
|
234
|
+
async def _impl(
|
|
235
|
+
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Create,
|
|
236
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
237
|
+
):
|
|
172
238
|
#* Validate chosen controller type
|
|
173
239
|
if not isinstance(
|
|
174
240
|
controller_type,
|
|
@@ -206,7 +272,10 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
206
272
|
.SingleData
|
|
207
273
|
.model_validate(controller_result.content)
|
|
208
274
|
)
|
|
209
|
-
return await _impl(
|
|
275
|
+
return await _impl(
|
|
276
|
+
parameters=parameters,
|
|
277
|
+
controller_type=controller_type
|
|
278
|
+
)
|
|
210
279
|
|
|
211
280
|
async def update(
|
|
212
281
|
self,
|
|
@@ -219,7 +288,10 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
219
288
|
logger=self._logger,
|
|
220
289
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
221
290
|
)
|
|
222
|
-
async def _impl(
|
|
291
|
+
async def _impl(
|
|
292
|
+
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Update,
|
|
293
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
294
|
+
):
|
|
223
295
|
#* Validate chosen controller type
|
|
224
296
|
if not isinstance(
|
|
225
297
|
controller_type,
|
|
@@ -257,7 +329,10 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
257
329
|
.SingleData
|
|
258
330
|
.model_validate(controller_result.content)
|
|
259
331
|
)
|
|
260
|
-
return await _impl(
|
|
332
|
+
return await _impl(
|
|
333
|
+
parameters=parameters,
|
|
334
|
+
controller_type=controller_type
|
|
335
|
+
)
|
|
261
336
|
|
|
262
337
|
async def get_organization_users(
|
|
263
338
|
self,
|
|
@@ -270,7 +345,30 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
270
345
|
logger=self._logger,
|
|
271
346
|
fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
|
|
272
347
|
)
|
|
273
|
-
|
|
348
|
+
@BaseClientUtils.result_processor(
|
|
349
|
+
fail_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail,
|
|
350
|
+
data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.MultipleData,
|
|
351
|
+
no_data_class=MaleoIdentityUserOrganizationClientResultsTransfers.NoData
|
|
352
|
+
)
|
|
353
|
+
@cached(
|
|
354
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
355
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
356
|
+
"organization_user",
|
|
357
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
358
|
+
base_override=self.key
|
|
359
|
+
),
|
|
360
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
361
|
+
cache=Cache.REDIS,
|
|
362
|
+
serializer=JsonSerializer(),
|
|
363
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
364
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
365
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
366
|
+
db=self.service_manager.configs.cache.redis.db
|
|
367
|
+
)
|
|
368
|
+
async def _impl(
|
|
369
|
+
parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromOrganization,
|
|
370
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
371
|
+
):
|
|
274
372
|
#* Validate chosen controller type
|
|
275
373
|
if not isinstance(
|
|
276
374
|
controller_type,
|
|
@@ -301,6 +399,7 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
301
399
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
302
400
|
.Fail
|
|
303
401
|
.model_validate(controller_result.content)
|
|
402
|
+
.model_dump(mode="json")
|
|
304
403
|
)
|
|
305
404
|
else:
|
|
306
405
|
if controller_result.content["data"] is None:
|
|
@@ -308,14 +407,19 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
308
407
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
309
408
|
.NoData
|
|
310
409
|
.model_validate(controller_result.content)
|
|
410
|
+
.model_dump(mode="json")
|
|
311
411
|
)
|
|
312
412
|
else:
|
|
313
413
|
return (
|
|
314
414
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
315
415
|
.MultipleData
|
|
316
416
|
.model_validate(controller_result.content)
|
|
417
|
+
.model_dump(mode="json")
|
|
317
418
|
)
|
|
318
|
-
return await _impl(
|
|
419
|
+
return await _impl(
|
|
420
|
+
parameters=parameters,
|
|
421
|
+
controller_type=controller_type
|
|
422
|
+
)
|
|
319
423
|
|
|
320
424
|
async def get_organization_user(
|
|
321
425
|
self,
|
|
@@ -328,7 +432,29 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
328
432
|
logger=self._logger,
|
|
329
433
|
fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
|
|
330
434
|
)
|
|
331
|
-
|
|
435
|
+
@BaseClientUtils.result_processor(
|
|
436
|
+
fail_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail,
|
|
437
|
+
data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.SingleData
|
|
438
|
+
)
|
|
439
|
+
@cached(
|
|
440
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
441
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
442
|
+
"user_organization",
|
|
443
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
444
|
+
base_override=self.key
|
|
445
|
+
),
|
|
446
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
447
|
+
cache=Cache.REDIS,
|
|
448
|
+
serializer=JsonSerializer(),
|
|
449
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
450
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
451
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
452
|
+
db=self.service_manager.configs.cache.redis.db
|
|
453
|
+
)
|
|
454
|
+
async def _impl(
|
|
455
|
+
parameters:MaleoIdentityUserOrganizationGeneralParametersTransfers.GetSingle,
|
|
456
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
457
|
+
):
|
|
332
458
|
#* Validate chosen controller type
|
|
333
459
|
if not isinstance(
|
|
334
460
|
controller_type,
|
|
@@ -359,14 +485,19 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
359
485
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
360
486
|
.Fail
|
|
361
487
|
.model_validate(controller_result.content)
|
|
488
|
+
.model_dump(mode="json")
|
|
362
489
|
)
|
|
363
490
|
else:
|
|
364
491
|
return (
|
|
365
492
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
366
493
|
.SingleData
|
|
367
494
|
.model_validate(controller_result.content)
|
|
495
|
+
.model_dump(mode="json")
|
|
368
496
|
)
|
|
369
|
-
return await _impl(
|
|
497
|
+
return await _impl(
|
|
498
|
+
parameters=parameters,
|
|
499
|
+
controller_type=controller_type
|
|
500
|
+
)
|
|
370
501
|
|
|
371
502
|
async def get_organization_roles(
|
|
372
503
|
self,
|
|
@@ -379,7 +510,30 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
379
510
|
logger=self._logger,
|
|
380
511
|
fail_result_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail
|
|
381
512
|
)
|
|
382
|
-
|
|
513
|
+
@BaseClientUtils.result_processor(
|
|
514
|
+
fail_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail,
|
|
515
|
+
data_found_class=MaleoIdentityOrganizationRoleClientResultsTransfers.MultipleData,
|
|
516
|
+
no_data_class=MaleoIdentityOrganizationRoleClientResultsTransfers.NoData
|
|
517
|
+
)
|
|
518
|
+
@cached(
|
|
519
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
520
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
521
|
+
"organization_role",
|
|
522
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
523
|
+
base_override=self.key
|
|
524
|
+
),
|
|
525
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
526
|
+
cache=Cache.REDIS,
|
|
527
|
+
serializer=JsonSerializer(),
|
|
528
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
529
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
530
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
531
|
+
db=self.service_manager.configs.cache.redis.db
|
|
532
|
+
)
|
|
533
|
+
async def _impl(
|
|
534
|
+
parameters:MaleoIdentityOrganizationRoleClientParametersTransfers.GetMultipleFromOrganization,
|
|
535
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
536
|
+
):
|
|
383
537
|
#* Validate chosen controller type
|
|
384
538
|
if not isinstance(
|
|
385
539
|
controller_type,
|
|
@@ -410,6 +564,7 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
410
564
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
411
565
|
.Fail
|
|
412
566
|
.model_validate(controller_result.content)
|
|
567
|
+
.model_dump(mode="json")
|
|
413
568
|
)
|
|
414
569
|
else:
|
|
415
570
|
if controller_result.content["data"] is None:
|
|
@@ -417,14 +572,19 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
417
572
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
418
573
|
.NoData
|
|
419
574
|
.model_validate(controller_result.content)
|
|
575
|
+
.model_dump(mode="json")
|
|
420
576
|
)
|
|
421
577
|
else:
|
|
422
578
|
return (
|
|
423
579
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
424
580
|
.MultipleData
|
|
425
581
|
.model_validate(controller_result.content)
|
|
582
|
+
.model_dump(mode="json")
|
|
426
583
|
)
|
|
427
|
-
return await _impl(
|
|
584
|
+
return await _impl(
|
|
585
|
+
parameters=parameters,
|
|
586
|
+
controller_type=controller_type
|
|
587
|
+
)
|
|
428
588
|
|
|
429
589
|
async def get_organization_role(
|
|
430
590
|
self,
|
|
@@ -437,7 +597,29 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
437
597
|
logger=self._logger,
|
|
438
598
|
fail_result_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail
|
|
439
599
|
)
|
|
440
|
-
|
|
600
|
+
@BaseClientUtils.result_processor(
|
|
601
|
+
fail_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail,
|
|
602
|
+
data_found_class=MaleoIdentityOrganizationRoleClientResultsTransfers.SingleData
|
|
603
|
+
)
|
|
604
|
+
@cached(
|
|
605
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
606
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
607
|
+
"organization_role",
|
|
608
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
609
|
+
base_override=self.key
|
|
610
|
+
),
|
|
611
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
612
|
+
cache=Cache.REDIS,
|
|
613
|
+
serializer=JsonSerializer(),
|
|
614
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
615
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
616
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
617
|
+
db=self.service_manager.configs.cache.redis.db
|
|
618
|
+
)
|
|
619
|
+
async def _impl(
|
|
620
|
+
parameters:MaleoIdentityOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
621
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
622
|
+
):
|
|
441
623
|
#* Validate chosen controller type
|
|
442
624
|
if not isinstance(
|
|
443
625
|
controller_type,
|
|
@@ -468,14 +650,19 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
468
650
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
469
651
|
.Fail
|
|
470
652
|
.model_validate(controller_result.content)
|
|
653
|
+
.model_dump(mode="json")
|
|
471
654
|
)
|
|
472
655
|
else:
|
|
473
656
|
return (
|
|
474
657
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
475
658
|
.SingleData
|
|
476
659
|
.model_validate(controller_result.content)
|
|
660
|
+
.model_dump(mode="json")
|
|
477
661
|
)
|
|
478
|
-
return await _impl(
|
|
662
|
+
return await _impl(
|
|
663
|
+
parameters=parameters,
|
|
664
|
+
controller_type=controller_type
|
|
665
|
+
)
|
|
479
666
|
|
|
480
667
|
async def get_organization_user_roles(
|
|
481
668
|
self,
|
|
@@ -488,7 +675,30 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
488
675
|
logger=self._logger,
|
|
489
676
|
fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
|
|
490
677
|
)
|
|
491
|
-
|
|
678
|
+
@BaseClientUtils.result_processor(
|
|
679
|
+
fail_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail,
|
|
680
|
+
data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.MultipleData,
|
|
681
|
+
no_data_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.NoData
|
|
682
|
+
)
|
|
683
|
+
@cached(
|
|
684
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
685
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
686
|
+
"user_organization_role",
|
|
687
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
688
|
+
base_override=self.key
|
|
689
|
+
),
|
|
690
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
691
|
+
cache=Cache.REDIS,
|
|
692
|
+
serializer=JsonSerializer(),
|
|
693
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
694
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
695
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
696
|
+
db=self.service_manager.configs.cache.redis.db
|
|
697
|
+
)
|
|
698
|
+
async def _impl(
|
|
699
|
+
parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
|
|
700
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
701
|
+
):
|
|
492
702
|
#* Validate chosen controller type
|
|
493
703
|
if not isinstance(
|
|
494
704
|
controller_type,
|
|
@@ -519,6 +729,7 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
519
729
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
520
730
|
.Fail
|
|
521
731
|
.model_validate(controller_result.content)
|
|
732
|
+
.model_dump(mode="json")
|
|
522
733
|
)
|
|
523
734
|
else:
|
|
524
735
|
if controller_result.content["data"] is None:
|
|
@@ -526,14 +737,19 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
526
737
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
527
738
|
.NoData
|
|
528
739
|
.model_validate(controller_result.content)
|
|
740
|
+
.model_dump(mode="json")
|
|
529
741
|
)
|
|
530
742
|
else:
|
|
531
743
|
return (
|
|
532
744
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
533
745
|
.MultipleData
|
|
534
746
|
.model_validate(controller_result.content)
|
|
747
|
+
.model_dump(mode="json")
|
|
535
748
|
)
|
|
536
|
-
return await _impl(
|
|
749
|
+
return await _impl(
|
|
750
|
+
parameters=parameters,
|
|
751
|
+
controller_type=controller_type
|
|
752
|
+
)
|
|
537
753
|
|
|
538
754
|
async def get_organization_user_role(
|
|
539
755
|
self,
|
|
@@ -546,7 +762,29 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
546
762
|
logger=self._logger,
|
|
547
763
|
fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
|
|
548
764
|
)
|
|
549
|
-
|
|
765
|
+
@BaseClientUtils.result_processor(
|
|
766
|
+
fail_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail,
|
|
767
|
+
data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.SingleData
|
|
768
|
+
)
|
|
769
|
+
@cached(
|
|
770
|
+
ttl=int(BaseEnums.CacheTTL.TTL_1DY),
|
|
771
|
+
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
772
|
+
"user_organization_role",
|
|
773
|
+
type=BaseEnums.CacheType.CLIENT,
|
|
774
|
+
base_override=self.key
|
|
775
|
+
),
|
|
776
|
+
key_builder=BaseCacheConfigurations.key_builder,
|
|
777
|
+
cache=Cache.REDIS,
|
|
778
|
+
serializer=JsonSerializer(),
|
|
779
|
+
endpoint=self.service_manager.configs.cache.redis.host,
|
|
780
|
+
port=self.service_manager.configs.cache.redis.port,
|
|
781
|
+
password=self.service_manager.configs.cache.redis.password,
|
|
782
|
+
db=self.service_manager.configs.cache.redis.db
|
|
783
|
+
)
|
|
784
|
+
async def _impl(
|
|
785
|
+
parameters:MaleoIdentityUserOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
786
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
787
|
+
):
|
|
550
788
|
#* Validate chosen controller type
|
|
551
789
|
if not isinstance(
|
|
552
790
|
controller_type,
|
|
@@ -577,11 +815,16 @@ class MaleoIdentityOrganizationClientService(ClientService):
|
|
|
577
815
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
578
816
|
.Fail
|
|
579
817
|
.model_validate(controller_result.content)
|
|
818
|
+
.model_dump(mode="json")
|
|
580
819
|
)
|
|
581
820
|
else:
|
|
582
821
|
return (
|
|
583
822
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
584
823
|
.SingleData
|
|
585
824
|
.model_validate(controller_result.content)
|
|
825
|
+
.model_dump(mode="json")
|
|
586
826
|
)
|
|
587
|
-
return await _impl(
|
|
827
|
+
return await _impl(
|
|
828
|
+
parameters=parameters,
|
|
829
|
+
controller_type=controller_type
|
|
830
|
+
)
|