maleo-identity 0.0.55__py3-none-any.whl → 0.0.58__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/http/organization.py +300 -63
- maleo_identity/client/controllers/http/user.py +253 -52
- maleo_identity/client/services/organization.py +184 -418
- maleo_identity/client/services/user.py +159 -345
- maleo_identity/constants/organization_role.py +4 -2
- maleo_identity/constants/user.py +3 -0
- maleo_identity/constants/user_organization.py +19 -4
- maleo_identity/constants/user_organization_role.py +8 -4
- maleo_identity/constants/user_system_role.py +1 -10
- maleo_identity/enums/organization.py +1 -1
- maleo_identity/enums/organization_role.py +2 -1
- maleo_identity/enums/user.py +2 -0
- maleo_identity/enums/user_organization.py +8 -2
- maleo_identity/enums/user_organization_role.py +8 -1
- maleo_identity/enums/user_system_role.py +0 -5
- maleo_identity/models/responses/user.py +13 -1
- maleo_identity/models/schemas/user.py +5 -1
- maleo_identity/models/tables/organization.py +21 -2
- maleo_identity/models/tables/organization_registration_code.py +14 -6
- maleo_identity/models/tables/organization_role.py +35 -4
- maleo_identity/models/tables/user.py +17 -3
- maleo_identity/models/tables/user_organization.py +52 -4
- maleo_identity/models/tables/user_organization_role.py +63 -4
- maleo_identity/models/tables/user_profile.py +11 -4
- maleo_identity/models/tables/user_system_role.py +12 -5
- maleo_identity/models/transfers/general/organization.py +4 -1
- maleo_identity/models/transfers/general/organization_role.py +5 -1
- maleo_identity/models/transfers/general/user.py +6 -1
- maleo_identity/models/transfers/general/user_organization.py +5 -1
- maleo_identity/models/transfers/general/user_organization_role.py +10 -10
- maleo_identity/models/transfers/general/user_system_role.py +6 -3
- maleo_identity/models/transfers/results/client/user.py +7 -1
- maleo_identity/models/transfers/results/general/user.py +7 -1
- maleo_identity/models/transfers/results/repository/user.py +7 -1
- maleo_identity/types/results/client/user.py +5 -0
- maleo_identity/types/results/general/user.py +5 -0
- maleo_identity/types/results/repository/user.py +5 -0
- {maleo_identity-0.0.55.dist-info → maleo_identity-0.0.58.dist-info}/METADATA +3 -3
- {maleo_identity-0.0.55.dist-info → maleo_identity-0.0.58.dist-info}/RECORD +41 -41
- {maleo_identity-0.0.55.dist-info → maleo_identity-0.0.58.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.55.dist-info → maleo_identity-0.0.58.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from maleo_foundation.enums import BaseEnums
|
|
4
|
-
from maleo_foundation.managers.cache.base import BaseCacheConfigurations
|
|
1
|
+
from typing import Dict, Optional
|
|
2
|
+
from maleo_foundation.authorization import Authorization
|
|
5
3
|
from maleo_foundation.managers.client.maleo import MaleoClientService
|
|
6
|
-
from maleo_foundation.utils.client import BaseClientUtils
|
|
7
4
|
from maleo_foundation.utils.exceptions import BaseExceptions
|
|
8
5
|
from maleo_identity.client.controllers import MaleoIdentityUserControllers
|
|
9
6
|
from maleo_identity.enums.general import MaleoIdentityGeneralEnums
|
|
@@ -58,7 +55,9 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
58
55
|
async def get_users(
|
|
59
56
|
self,
|
|
60
57
|
parameters:MaleoIdentityUserClientParametersTransfers.GetMultiple,
|
|
61
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
58
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
59
|
+
authorization:Optional[Authorization] = None,
|
|
60
|
+
headers:Optional[Dict[str, str]] = None
|
|
62
61
|
) -> MaleoIdentityUserClientResultsTypes.GetMultiple:
|
|
63
62
|
"""Retrieve users from MaleoIdentity"""
|
|
64
63
|
@BaseExceptions.service_exception_handler(
|
|
@@ -66,40 +65,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
66
65
|
logger=self._logger,
|
|
67
66
|
fail_result_class=MaleoIdentityUserClientResultsTransfers.Fail
|
|
68
67
|
)
|
|
69
|
-
# @BaseClientUtils.result_processor(
|
|
70
|
-
# fail_class=MaleoIdentityUserClientResultsTransfers.Fail,
|
|
71
|
-
# data_found_class=MaleoIdentityUserClientResultsTransfers.MultipleData,
|
|
72
|
-
# no_data_class=MaleoIdentityUserClientResultsTransfers.NoData
|
|
73
|
-
# )
|
|
74
|
-
# @cached(
|
|
75
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
76
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
77
|
-
# "user",
|
|
78
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
79
|
-
# base_override=self.key
|
|
80
|
-
# ),
|
|
81
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
82
|
-
# skip_cache_func=lambda x: (
|
|
83
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
84
|
-
# or x is None
|
|
85
|
-
# or (
|
|
86
|
-
# isinstance(x, dict)
|
|
87
|
-
# and (
|
|
88
|
-
# x.get("success") in [False, None]
|
|
89
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
90
|
-
# )
|
|
91
|
-
# )
|
|
92
|
-
# ),
|
|
93
|
-
# cache=Cache.REDIS,
|
|
94
|
-
# serializer=JsonSerializer(),
|
|
95
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
96
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
97
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
98
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
99
|
-
# )
|
|
100
68
|
async def _impl(
|
|
101
69
|
parameters:MaleoIdentityUserClientParametersTransfers.GetMultiple,
|
|
102
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
70
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
71
|
+
authorization:Optional[Authorization] = None,
|
|
72
|
+
headers:Optional[Dict[str, str]] = None
|
|
103
73
|
):
|
|
104
74
|
#* Validate chosen controller type
|
|
105
75
|
if not isinstance(
|
|
@@ -116,7 +86,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
116
86
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
117
87
|
controller_result = (
|
|
118
88
|
await self._controllers.http
|
|
119
|
-
.get_users(
|
|
89
|
+
.get_users(
|
|
90
|
+
parameters=parameters,
|
|
91
|
+
authorization=authorization,
|
|
92
|
+
headers=headers
|
|
93
|
+
)
|
|
120
94
|
)
|
|
121
95
|
else:
|
|
122
96
|
message = "Invalid controller type"
|
|
@@ -131,7 +105,6 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
131
105
|
MaleoIdentityUserClientResultsTransfers
|
|
132
106
|
.Fail
|
|
133
107
|
.model_validate(controller_result.content)
|
|
134
|
-
# .model_dump(mode="json")
|
|
135
108
|
)
|
|
136
109
|
else:
|
|
137
110
|
if controller_result.content["data"] is None:
|
|
@@ -139,24 +112,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
139
112
|
MaleoIdentityUserClientResultsTransfers
|
|
140
113
|
.NoData
|
|
141
114
|
.model_validate(controller_result.content)
|
|
142
|
-
# .model_dump(mode="json")
|
|
143
115
|
)
|
|
144
116
|
else:
|
|
145
117
|
return (
|
|
146
118
|
MaleoIdentityUserClientResultsTransfers
|
|
147
119
|
.MultipleData
|
|
148
120
|
.model_validate(controller_result.content)
|
|
149
|
-
# .model_dump(mode="json")
|
|
150
121
|
)
|
|
151
122
|
return await _impl(
|
|
152
123
|
parameters=parameters,
|
|
153
|
-
controller_type=controller_type
|
|
124
|
+
controller_type=controller_type,
|
|
125
|
+
authorization=authorization,
|
|
126
|
+
headers=headers
|
|
154
127
|
)
|
|
155
128
|
|
|
156
129
|
async def get_user(
|
|
157
130
|
self,
|
|
158
131
|
parameters:MaleoIdentityUserGeneralParametersTransfers.GetSingle,
|
|
159
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
132
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
133
|
+
authorization:Optional[Authorization] = None,
|
|
134
|
+
headers:Optional[Dict[str, str]] = None
|
|
160
135
|
) -> MaleoIdentityUserClientResultsTypes.GetSingle:
|
|
161
136
|
"""Retrieve user from MaleoIdentity"""
|
|
162
137
|
@BaseExceptions.service_exception_handler(
|
|
@@ -164,39 +139,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
164
139
|
logger=self._logger,
|
|
165
140
|
fail_result_class=MaleoIdentityUserClientResultsTransfers.Fail
|
|
166
141
|
)
|
|
167
|
-
@BaseClientUtils.result_processor(
|
|
168
|
-
fail_class=MaleoIdentityUserClientResultsTransfers.Fail,
|
|
169
|
-
data_found_class=MaleoIdentityUserClientResultsTransfers.SingleData
|
|
170
|
-
)
|
|
171
|
-
@cached(
|
|
172
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
173
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
174
|
-
"user",
|
|
175
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
176
|
-
base_override=self.key
|
|
177
|
-
),
|
|
178
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
179
|
-
skip_cache_func=lambda x: (
|
|
180
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
181
|
-
or x is None
|
|
182
|
-
or (
|
|
183
|
-
isinstance(x, dict)
|
|
184
|
-
and (
|
|
185
|
-
x.get("success") in [False, None]
|
|
186
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
187
|
-
)
|
|
188
|
-
)
|
|
189
|
-
),
|
|
190
|
-
cache=Cache.REDIS,
|
|
191
|
-
serializer=JsonSerializer(),
|
|
192
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
193
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
194
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
195
|
-
db=self.service_manager.configs.cache.redis.db
|
|
196
|
-
)
|
|
197
142
|
async def _impl(
|
|
198
143
|
parameters:MaleoIdentityUserGeneralParametersTransfers.GetSingle,
|
|
199
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
144
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
145
|
+
authorization:Optional[Authorization] = None,
|
|
146
|
+
headers:Optional[Dict[str, str]] = None
|
|
200
147
|
):
|
|
201
148
|
#* Validate chosen controller type
|
|
202
149
|
if not isinstance(
|
|
@@ -213,7 +160,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
213
160
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
214
161
|
controller_result = (
|
|
215
162
|
await self._controllers.http
|
|
216
|
-
.get_user(
|
|
163
|
+
.get_user(
|
|
164
|
+
parameters=parameters,
|
|
165
|
+
authorization=authorization,
|
|
166
|
+
headers=headers
|
|
167
|
+
)
|
|
217
168
|
)
|
|
218
169
|
else:
|
|
219
170
|
message = "Invalid controller type"
|
|
@@ -228,24 +179,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
228
179
|
MaleoIdentityUserClientResultsTransfers
|
|
229
180
|
.Fail
|
|
230
181
|
.model_validate(controller_result.content)
|
|
231
|
-
.model_dump(mode="json")
|
|
232
182
|
)
|
|
233
183
|
else:
|
|
234
184
|
return (
|
|
235
185
|
MaleoIdentityUserClientResultsTransfers
|
|
236
186
|
.SingleData
|
|
237
187
|
.model_validate(controller_result.content)
|
|
238
|
-
.model_dump(mode="json")
|
|
239
188
|
)
|
|
240
189
|
return await _impl(
|
|
241
190
|
parameters=parameters,
|
|
242
|
-
controller_type=controller_type
|
|
191
|
+
controller_type=controller_type,
|
|
192
|
+
authorization=authorization,
|
|
193
|
+
headers=headers
|
|
243
194
|
)
|
|
244
195
|
|
|
245
196
|
async def create(
|
|
246
197
|
self,
|
|
247
198
|
parameters:MaleoIdentityUserGeneralParametersTransfers.Create,
|
|
248
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
199
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
200
|
+
authorization:Optional[Authorization] = None,
|
|
201
|
+
headers:Optional[Dict[str, str]] = None
|
|
249
202
|
) -> MaleoIdentityUserClientResultsTypes.CreateOrUpdate:
|
|
250
203
|
"""Create a new user in MaleoIdentity"""
|
|
251
204
|
@BaseExceptions.service_exception_handler(
|
|
@@ -255,7 +208,9 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
255
208
|
)
|
|
256
209
|
async def _impl(
|
|
257
210
|
parameters:MaleoIdentityUserGeneralParametersTransfers.Create,
|
|
258
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
211
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
212
|
+
authorization:Optional[Authorization] = None,
|
|
213
|
+
headers:Optional[Dict[str, str]] = None
|
|
259
214
|
):
|
|
260
215
|
#* Validate chosen controller type
|
|
261
216
|
if not isinstance(
|
|
@@ -272,7 +227,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
272
227
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
273
228
|
controller_result = (
|
|
274
229
|
await self._controllers.http
|
|
275
|
-
.create(
|
|
230
|
+
.create(
|
|
231
|
+
parameters=parameters,
|
|
232
|
+
authorization=authorization,
|
|
233
|
+
headers=headers
|
|
234
|
+
)
|
|
276
235
|
)
|
|
277
236
|
else:
|
|
278
237
|
message = "Invalid controller type"
|
|
@@ -296,13 +255,17 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
296
255
|
)
|
|
297
256
|
return await _impl(
|
|
298
257
|
parameters=parameters,
|
|
299
|
-
controller_type=controller_type
|
|
258
|
+
controller_type=controller_type,
|
|
259
|
+
authorization=authorization,
|
|
260
|
+
headers=headers
|
|
300
261
|
)
|
|
301
262
|
|
|
302
263
|
async def update(
|
|
303
264
|
self,
|
|
304
265
|
parameters:MaleoIdentityUserGeneralParametersTransfers.Update,
|
|
305
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
266
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
267
|
+
authorization:Optional[Authorization] = None,
|
|
268
|
+
headers:Optional[Dict[str, str]] = None
|
|
306
269
|
) -> MaleoIdentityUserClientResultsTypes.CreateOrUpdate:
|
|
307
270
|
"""Update user's data in MaleoIdentity"""
|
|
308
271
|
@BaseExceptions.service_exception_handler(
|
|
@@ -312,7 +275,9 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
312
275
|
)
|
|
313
276
|
async def _impl(
|
|
314
277
|
parameters:MaleoIdentityUserGeneralParametersTransfers.Update,
|
|
315
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
278
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
279
|
+
authorization:Optional[Authorization] = None,
|
|
280
|
+
headers:Optional[Dict[str, str]] = None
|
|
316
281
|
):
|
|
317
282
|
#* Validate chosen controller type
|
|
318
283
|
if not isinstance(
|
|
@@ -329,7 +294,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
329
294
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
330
295
|
controller_result = (
|
|
331
296
|
await self._controllers.http
|
|
332
|
-
.update(
|
|
297
|
+
.update(
|
|
298
|
+
parameters=parameters,
|
|
299
|
+
authorization=authorization,
|
|
300
|
+
headers=headers
|
|
301
|
+
)
|
|
333
302
|
)
|
|
334
303
|
else:
|
|
335
304
|
message = "Invalid controller type"
|
|
@@ -353,13 +322,17 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
353
322
|
)
|
|
354
323
|
return await _impl(
|
|
355
324
|
parameters=parameters,
|
|
356
|
-
controller_type=controller_type
|
|
325
|
+
controller_type=controller_type,
|
|
326
|
+
authorization=authorization,
|
|
327
|
+
headers=headers
|
|
357
328
|
)
|
|
358
329
|
|
|
359
330
|
async def get_password(
|
|
360
331
|
self,
|
|
361
332
|
parameters:MaleoIdentityUserGeneralParametersTransfers.GetSinglePassword,
|
|
362
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
333
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
334
|
+
authorization:Optional[Authorization] = None,
|
|
335
|
+
headers:Optional[Dict[str, str]] = None
|
|
363
336
|
) -> MaleoIdentityUserClientResultsTypes.GetSinglePassword:
|
|
364
337
|
"""Retrieve user's password from MaleoIdentity"""
|
|
365
338
|
@BaseExceptions.service_exception_handler(
|
|
@@ -367,39 +340,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
367
340
|
logger=self._logger,
|
|
368
341
|
fail_result_class=MaleoIdentityUserClientResultsTransfers.Fail
|
|
369
342
|
)
|
|
370
|
-
@BaseClientUtils.result_processor(
|
|
371
|
-
fail_class=MaleoIdentityUserClientResultsTransfers.Fail,
|
|
372
|
-
data_found_class=MaleoIdentityUserClientResultsTransfers.SinglePassword
|
|
373
|
-
)
|
|
374
|
-
@cached(
|
|
375
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
376
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
377
|
-
"user",
|
|
378
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
379
|
-
base_override=self.key
|
|
380
|
-
),
|
|
381
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
382
|
-
skip_cache_func=lambda x: (
|
|
383
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
384
|
-
or x is None
|
|
385
|
-
or (
|
|
386
|
-
isinstance(x, dict)
|
|
387
|
-
and (
|
|
388
|
-
x.get("success") in [False, None]
|
|
389
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
390
|
-
)
|
|
391
|
-
)
|
|
392
|
-
),
|
|
393
|
-
cache=Cache.REDIS,
|
|
394
|
-
serializer=JsonSerializer(),
|
|
395
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
396
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
397
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
398
|
-
db=self.service_manager.configs.cache.redis.db
|
|
399
|
-
)
|
|
400
343
|
async def _impl(
|
|
401
344
|
parameters:MaleoIdentityUserGeneralParametersTransfers.GetSinglePassword,
|
|
402
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
345
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
346
|
+
authorization:Optional[Authorization] = None,
|
|
347
|
+
headers:Optional[Dict[str, str]] = None
|
|
403
348
|
):
|
|
404
349
|
#* Validate chosen controller type
|
|
405
350
|
if not isinstance(
|
|
@@ -416,7 +361,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
416
361
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
417
362
|
controller_result = (
|
|
418
363
|
await self._controllers.http
|
|
419
|
-
.get_password(
|
|
364
|
+
.get_password(
|
|
365
|
+
parameters=parameters,
|
|
366
|
+
authorization=authorization,
|
|
367
|
+
headers=headers
|
|
368
|
+
)
|
|
420
369
|
)
|
|
421
370
|
else:
|
|
422
371
|
message = "Invalid controller type"
|
|
@@ -431,24 +380,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
431
380
|
MaleoIdentityUserClientResultsTransfers
|
|
432
381
|
.Fail
|
|
433
382
|
.model_validate(controller_result.content)
|
|
434
|
-
.model_dump(mode="json")
|
|
435
383
|
)
|
|
436
384
|
else:
|
|
437
385
|
return (
|
|
438
386
|
MaleoIdentityUserClientResultsTransfers
|
|
439
387
|
.SinglePassword
|
|
440
388
|
.model_validate(controller_result.content)
|
|
441
|
-
.model_dump(mode="json")
|
|
442
389
|
)
|
|
443
390
|
return await _impl(
|
|
444
391
|
parameters=parameters,
|
|
445
|
-
controller_type=controller_type
|
|
392
|
+
controller_type=controller_type,
|
|
393
|
+
authorization=authorization,
|
|
394
|
+
headers=headers
|
|
446
395
|
)
|
|
447
396
|
|
|
448
397
|
async def get_user_organizations(
|
|
449
398
|
self,
|
|
450
399
|
parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromUser,
|
|
451
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
400
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
401
|
+
authorization:Optional[Authorization] = None,
|
|
402
|
+
headers:Optional[Dict[str, str]] = None
|
|
452
403
|
) -> MaleoIdentityUserOrganizationClientResultsTypes.GetMultiple:
|
|
453
404
|
"""Retrieve user's organizations from MaleoIdentity"""
|
|
454
405
|
@BaseExceptions.service_exception_handler(
|
|
@@ -456,40 +407,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
456
407
|
logger=self._logger,
|
|
457
408
|
fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
|
|
458
409
|
)
|
|
459
|
-
# @BaseClientUtils.result_processor(
|
|
460
|
-
# fail_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail,
|
|
461
|
-
# data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.MultipleData,
|
|
462
|
-
# no_data_class=MaleoIdentityUserOrganizationClientResultsTransfers.NoData
|
|
463
|
-
# )
|
|
464
|
-
# @cached(
|
|
465
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
466
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
467
|
-
# "user_organization",
|
|
468
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
469
|
-
# base_override=self.key
|
|
470
|
-
# ),
|
|
471
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
472
|
-
# skip_cache_func=lambda x: (
|
|
473
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
474
|
-
# or x is None
|
|
475
|
-
# or (
|
|
476
|
-
# isinstance(x, dict)
|
|
477
|
-
# and (
|
|
478
|
-
# x.get("success") in [False, None]
|
|
479
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
480
|
-
# )
|
|
481
|
-
# )
|
|
482
|
-
# ),
|
|
483
|
-
# cache=Cache.REDIS,
|
|
484
|
-
# serializer=JsonSerializer(),
|
|
485
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
486
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
487
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
488
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
489
|
-
# )
|
|
490
410
|
async def _impl(
|
|
491
411
|
parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromUser,
|
|
492
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
412
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
413
|
+
authorization:Optional[Authorization] = None,
|
|
414
|
+
headers:Optional[Dict[str, str]] = None
|
|
493
415
|
):
|
|
494
416
|
#* Validate chosen controller type
|
|
495
417
|
if not isinstance(
|
|
@@ -506,7 +428,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
506
428
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
507
429
|
controller_result = (
|
|
508
430
|
await self._controllers.http
|
|
509
|
-
.get_user_organizations(
|
|
431
|
+
.get_user_organizations(
|
|
432
|
+
parameters=parameters,
|
|
433
|
+
authorization=authorization,
|
|
434
|
+
headers=headers
|
|
435
|
+
)
|
|
510
436
|
)
|
|
511
437
|
else:
|
|
512
438
|
message = "Invalid controller type"
|
|
@@ -521,7 +447,6 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
521
447
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
522
448
|
.Fail
|
|
523
449
|
.model_validate(controller_result.content)
|
|
524
|
-
# .model_dump(mode="json")
|
|
525
450
|
)
|
|
526
451
|
else:
|
|
527
452
|
if controller_result.content["data"] is None:
|
|
@@ -529,24 +454,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
529
454
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
530
455
|
.NoData
|
|
531
456
|
.model_validate(controller_result.content)
|
|
532
|
-
# .model_dump(mode="json")
|
|
533
457
|
)
|
|
534
458
|
else:
|
|
535
459
|
return (
|
|
536
460
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
537
461
|
.MultipleData
|
|
538
462
|
.model_validate(controller_result.content)
|
|
539
|
-
# .model_dump(mode="json")
|
|
540
463
|
)
|
|
541
464
|
return await _impl(
|
|
542
465
|
parameters=parameters,
|
|
543
|
-
controller_type=controller_type
|
|
466
|
+
controller_type=controller_type,
|
|
467
|
+
authorization=authorization,
|
|
468
|
+
headers=headers
|
|
544
469
|
)
|
|
545
470
|
|
|
546
471
|
async def get_user_organization(
|
|
547
472
|
self,
|
|
548
473
|
parameters:MaleoIdentityUserOrganizationGeneralParametersTransfers.GetSingle,
|
|
549
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
474
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
475
|
+
authorization:Optional[Authorization] = None,
|
|
476
|
+
headers:Optional[Dict[str, str]] = None
|
|
550
477
|
) -> MaleoIdentityUserOrganizationClientResultsTypes.GetSingle:
|
|
551
478
|
"""Retrieve user's organization from MaleoIdentity"""
|
|
552
479
|
@BaseExceptions.service_exception_handler(
|
|
@@ -554,39 +481,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
554
481
|
logger=self._logger,
|
|
555
482
|
fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
|
|
556
483
|
)
|
|
557
|
-
@BaseClientUtils.result_processor(
|
|
558
|
-
fail_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail,
|
|
559
|
-
data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.SingleData
|
|
560
|
-
)
|
|
561
|
-
@cached(
|
|
562
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
563
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
564
|
-
"user_organization",
|
|
565
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
566
|
-
base_override=self.key
|
|
567
|
-
),
|
|
568
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
569
|
-
skip_cache_func=lambda x: (
|
|
570
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
571
|
-
or x is None
|
|
572
|
-
or (
|
|
573
|
-
isinstance(x, dict)
|
|
574
|
-
and (
|
|
575
|
-
x.get("success") in [False, None]
|
|
576
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
577
|
-
)
|
|
578
|
-
)
|
|
579
|
-
),
|
|
580
|
-
cache=Cache.REDIS,
|
|
581
|
-
serializer=JsonSerializer(),
|
|
582
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
583
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
584
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
585
|
-
db=self.service_manager.configs.cache.redis.db
|
|
586
|
-
)
|
|
587
484
|
async def _impl(
|
|
588
485
|
parameters:MaleoIdentityUserOrganizationGeneralParametersTransfers.GetSingle,
|
|
589
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
486
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
487
|
+
authorization:Optional[Authorization] = None,
|
|
488
|
+
headers:Optional[Dict[str, str]] = None
|
|
590
489
|
):
|
|
591
490
|
#* Validate chosen controller type
|
|
592
491
|
if not isinstance(
|
|
@@ -603,7 +502,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
603
502
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
604
503
|
controller_result = (
|
|
605
504
|
await self._controllers.http
|
|
606
|
-
.get_user_organization(
|
|
505
|
+
.get_user_organization(
|
|
506
|
+
parameters=parameters,
|
|
507
|
+
authorization=authorization,
|
|
508
|
+
headers=headers
|
|
509
|
+
)
|
|
607
510
|
)
|
|
608
511
|
else:
|
|
609
512
|
message = "Invalid controller type"
|
|
@@ -618,24 +521,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
618
521
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
619
522
|
.Fail
|
|
620
523
|
.model_validate(controller_result.content)
|
|
621
|
-
.model_dump(mode="json")
|
|
622
524
|
)
|
|
623
525
|
else:
|
|
624
526
|
return (
|
|
625
527
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
626
528
|
.SingleData
|
|
627
529
|
.model_validate(controller_result.content)
|
|
628
|
-
.model_dump(mode="json")
|
|
629
530
|
)
|
|
630
531
|
return await _impl(
|
|
631
532
|
parameters=parameters,
|
|
632
|
-
controller_type=controller_type
|
|
533
|
+
controller_type=controller_type,
|
|
534
|
+
authorization=authorization,
|
|
535
|
+
headers=headers
|
|
633
536
|
)
|
|
634
537
|
|
|
635
538
|
async def get_user_system_roles(
|
|
636
539
|
self,
|
|
637
540
|
parameters:MaleoIdentityUserSystemRoleClientParametersTransfers.GetMultipleFromUser,
|
|
638
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
541
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
542
|
+
authorization:Optional[Authorization] = None,
|
|
543
|
+
headers:Optional[Dict[str, str]] = None
|
|
639
544
|
) -> MaleoIdentityUserSystemRoleClientResultsTypes.GetMultiple:
|
|
640
545
|
"""Retrieve user's system roles from MaleoIdentity"""
|
|
641
546
|
@BaseExceptions.service_exception_handler(
|
|
@@ -643,38 +548,12 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
643
548
|
logger=self._logger,
|
|
644
549
|
fail_result_class=MaleoIdentityUserSystemRoleClientResultsTransfers.Fail
|
|
645
550
|
)
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
653
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
654
|
-
# "user_system_role",
|
|
655
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
656
|
-
# base_override=self.key
|
|
657
|
-
# ),
|
|
658
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
659
|
-
# skip_cache_func=lambda x: (
|
|
660
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
661
|
-
# or x is None
|
|
662
|
-
# or (
|
|
663
|
-
# isinstance(x, dict)
|
|
664
|
-
# and (
|
|
665
|
-
# x.get("success") in [False, None]
|
|
666
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
667
|
-
# )
|
|
668
|
-
# )
|
|
669
|
-
# ),
|
|
670
|
-
# cache=Cache.REDIS,
|
|
671
|
-
# serializer=JsonSerializer(),
|
|
672
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
673
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
674
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
675
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
676
|
-
# )
|
|
677
|
-
async def _impl():
|
|
551
|
+
async def _impl(
|
|
552
|
+
parameters:MaleoIdentityUserSystemRoleClientParametersTransfers.GetMultipleFromUser,
|
|
553
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
554
|
+
authorization:Optional[Authorization] = None,
|
|
555
|
+
headers:Optional[Dict[str, str]] = None
|
|
556
|
+
):
|
|
678
557
|
#* Validate chosen controller type
|
|
679
558
|
if not isinstance(
|
|
680
559
|
controller_type,
|
|
@@ -690,7 +569,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
690
569
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
691
570
|
controller_result = (
|
|
692
571
|
await self._controllers.http
|
|
693
|
-
.get_user_system_roles(
|
|
572
|
+
.get_user_system_roles(
|
|
573
|
+
parameters=parameters,
|
|
574
|
+
authorization=authorization,
|
|
575
|
+
headers=headers
|
|
576
|
+
)
|
|
694
577
|
)
|
|
695
578
|
else:
|
|
696
579
|
message = "Invalid controller type"
|
|
@@ -705,7 +588,6 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
705
588
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
706
589
|
.Fail
|
|
707
590
|
.model_validate(controller_result.content)
|
|
708
|
-
# .model_dump(mode="json")
|
|
709
591
|
)
|
|
710
592
|
else:
|
|
711
593
|
if controller_result.content["data"] is None:
|
|
@@ -713,24 +595,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
713
595
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
714
596
|
.NoData
|
|
715
597
|
.model_validate(controller_result.content)
|
|
716
|
-
# .model_dump(mode="json")
|
|
717
598
|
)
|
|
718
599
|
else:
|
|
719
600
|
return (
|
|
720
601
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
721
602
|
.MultipleData
|
|
722
603
|
.model_validate(controller_result.content)
|
|
723
|
-
# .model_dump(mode="json")
|
|
724
604
|
)
|
|
725
605
|
return await _impl(
|
|
726
606
|
parameters=parameters,
|
|
727
|
-
controller_type=controller_type
|
|
607
|
+
controller_type=controller_type,
|
|
608
|
+
authorization=authorization,
|
|
609
|
+
headers=headers
|
|
728
610
|
)
|
|
729
611
|
|
|
730
612
|
async def get_user_system_role(
|
|
731
613
|
self,
|
|
732
614
|
parameters:MaleoIdentityUserSystemRoleGeneralParametersTransfers.GetSingle,
|
|
733
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
615
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
616
|
+
authorization:Optional[Authorization] = None,
|
|
617
|
+
headers:Optional[Dict[str, str]] = None
|
|
734
618
|
) -> MaleoIdentityUserSystemRoleClientResultsTypes.GetSingle:
|
|
735
619
|
"""Retrieve user's system role from MaleoIdentity"""
|
|
736
620
|
@BaseExceptions.service_exception_handler(
|
|
@@ -738,39 +622,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
738
622
|
logger=self._logger,
|
|
739
623
|
fail_result_class=MaleoIdentityUserSystemRoleClientResultsTransfers.Fail
|
|
740
624
|
)
|
|
741
|
-
@BaseClientUtils.result_processor(
|
|
742
|
-
fail_class=MaleoIdentityUserSystemRoleClientResultsTransfers.Fail,
|
|
743
|
-
data_found_class=MaleoIdentityUserSystemRoleClientResultsTransfers.SingleData
|
|
744
|
-
)
|
|
745
|
-
@cached(
|
|
746
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
747
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
748
|
-
"user_system_role",
|
|
749
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
750
|
-
base_override=self.key
|
|
751
|
-
),
|
|
752
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
753
|
-
skip_cache_func=lambda x: (
|
|
754
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
755
|
-
or x is None
|
|
756
|
-
or (
|
|
757
|
-
isinstance(x, dict)
|
|
758
|
-
and (
|
|
759
|
-
x.get("success") in [False, None]
|
|
760
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
761
|
-
)
|
|
762
|
-
)
|
|
763
|
-
),
|
|
764
|
-
cache=Cache.REDIS,
|
|
765
|
-
serializer=JsonSerializer(),
|
|
766
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
767
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
768
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
769
|
-
db=self.service_manager.configs.cache.redis.db
|
|
770
|
-
)
|
|
771
625
|
async def _impl(
|
|
772
626
|
parameters:MaleoIdentityUserSystemRoleClientParametersTransfers.GetMultipleFromUser,
|
|
773
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
627
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
628
|
+
authorization:Optional[Authorization] = None,
|
|
629
|
+
headers:Optional[Dict[str, str]] = None
|
|
774
630
|
):
|
|
775
631
|
#* Validate chosen controller type
|
|
776
632
|
if not isinstance(
|
|
@@ -786,7 +642,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
786
642
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
787
643
|
controller_result = (
|
|
788
644
|
await self._controllers.http
|
|
789
|
-
.get_user_system_role(
|
|
645
|
+
.get_user_system_role(
|
|
646
|
+
parameters=parameters,
|
|
647
|
+
authorization=authorization,
|
|
648
|
+
headers=headers
|
|
649
|
+
)
|
|
790
650
|
)
|
|
791
651
|
else:
|
|
792
652
|
message = "Invalid controller type"
|
|
@@ -801,24 +661,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
801
661
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
802
662
|
.Fail
|
|
803
663
|
.model_validate(controller_result.content)
|
|
804
|
-
.model_dump(mode="json")
|
|
805
664
|
)
|
|
806
665
|
else:
|
|
807
666
|
return (
|
|
808
667
|
MaleoIdentityUserSystemRoleClientResultsTransfers
|
|
809
668
|
.SingleData
|
|
810
669
|
.model_validate(controller_result.content)
|
|
811
|
-
.model_dump(mode="json")
|
|
812
670
|
)
|
|
813
671
|
return await _impl(
|
|
814
672
|
parameters=parameters,
|
|
815
|
-
controller_type=controller_type
|
|
673
|
+
controller_type=controller_type,
|
|
674
|
+
authorization=authorization,
|
|
675
|
+
headers=headers
|
|
816
676
|
)
|
|
817
677
|
|
|
818
678
|
async def get_user_organization_roles(
|
|
819
679
|
self,
|
|
820
680
|
parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
|
|
821
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
681
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
682
|
+
authorization:Optional[Authorization] = None,
|
|
683
|
+
headers:Optional[Dict[str, str]] = None
|
|
822
684
|
) -> MaleoIdentityUserOrganizationRoleClientResultsTypes.GetMultiple:
|
|
823
685
|
"""Retrieve user's organization roles from MaleoIdentity"""
|
|
824
686
|
@BaseExceptions.service_exception_handler(
|
|
@@ -826,40 +688,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
826
688
|
logger=self._logger,
|
|
827
689
|
fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
|
|
828
690
|
)
|
|
829
|
-
# @BaseClientUtils.result_processor(
|
|
830
|
-
# fail_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail,
|
|
831
|
-
# data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.MultipleData,
|
|
832
|
-
# no_data_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.NoData
|
|
833
|
-
# )
|
|
834
|
-
# @cached(
|
|
835
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
836
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
837
|
-
# "user_organization_role",
|
|
838
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
839
|
-
# base_override=self.key
|
|
840
|
-
# ),
|
|
841
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
842
|
-
# skip_cache_func=lambda x: (
|
|
843
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
844
|
-
# or x is None
|
|
845
|
-
# or (
|
|
846
|
-
# isinstance(x, dict)
|
|
847
|
-
# and (
|
|
848
|
-
# x.get("success") in [False, None]
|
|
849
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
850
|
-
# )
|
|
851
|
-
# )
|
|
852
|
-
# ),
|
|
853
|
-
# cache=Cache.REDIS,
|
|
854
|
-
# serializer=JsonSerializer(),
|
|
855
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
856
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
857
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
858
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
859
|
-
# )
|
|
860
691
|
async def _impl(
|
|
861
692
|
parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
|
|
862
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
693
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
694
|
+
authorization:Optional[Authorization] = None,
|
|
695
|
+
headers:Optional[Dict[str, str]] = None
|
|
863
696
|
):
|
|
864
697
|
#* Validate chosen controller type
|
|
865
698
|
if not isinstance(
|
|
@@ -876,7 +709,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
876
709
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
877
710
|
controller_result = (
|
|
878
711
|
await self._controllers.http
|
|
879
|
-
.get_user_organization_roles(
|
|
712
|
+
.get_user_organization_roles(
|
|
713
|
+
parameters=parameters,
|
|
714
|
+
authorization=authorization,
|
|
715
|
+
headers=headers
|
|
716
|
+
)
|
|
880
717
|
)
|
|
881
718
|
else:
|
|
882
719
|
message = "Invalid controller type"
|
|
@@ -891,7 +728,6 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
891
728
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
892
729
|
.Fail
|
|
893
730
|
.model_validate(controller_result.content)
|
|
894
|
-
# .model_dump(mode="json")
|
|
895
731
|
)
|
|
896
732
|
else:
|
|
897
733
|
if controller_result.content["data"] is None:
|
|
@@ -899,24 +735,26 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
899
735
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
900
736
|
.NoData
|
|
901
737
|
.model_validate(controller_result.content)
|
|
902
|
-
# .model_dump(mode="json")
|
|
903
738
|
)
|
|
904
739
|
else:
|
|
905
740
|
return (
|
|
906
741
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
907
742
|
.MultipleData
|
|
908
743
|
.model_validate(controller_result.content)
|
|
909
|
-
# .model_dump(mode="json")
|
|
910
744
|
)
|
|
911
745
|
return await _impl(
|
|
912
746
|
parameters=parameters,
|
|
913
|
-
controller_type=controller_type
|
|
747
|
+
controller_type=controller_type,
|
|
748
|
+
authorization=authorization,
|
|
749
|
+
headers=headers
|
|
914
750
|
)
|
|
915
751
|
|
|
916
752
|
async def get_user_organization_role(
|
|
917
753
|
self,
|
|
918
754
|
parameters:MaleoIdentityUserOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
919
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
755
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
756
|
+
authorization:Optional[Authorization] = None,
|
|
757
|
+
headers:Optional[Dict[str, str]] = None
|
|
920
758
|
) -> MaleoIdentityUserOrganizationRoleClientResultsTypes.GetSingle:
|
|
921
759
|
"""Retrieve user's organization role from MaleoIdentity"""
|
|
922
760
|
@BaseExceptions.service_exception_handler(
|
|
@@ -924,39 +762,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
924
762
|
logger=self._logger,
|
|
925
763
|
fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
|
|
926
764
|
)
|
|
927
|
-
@BaseClientUtils.result_processor(
|
|
928
|
-
fail_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail,
|
|
929
|
-
data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.SingleData
|
|
930
|
-
)
|
|
931
|
-
@cached(
|
|
932
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
933
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
934
|
-
"user_organization_role",
|
|
935
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
936
|
-
base_override=self.key
|
|
937
|
-
),
|
|
938
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
939
|
-
skip_cache_func=lambda x: (
|
|
940
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
941
|
-
or x is None
|
|
942
|
-
or (
|
|
943
|
-
isinstance(x, dict)
|
|
944
|
-
and (
|
|
945
|
-
x.get("success") in [False, None]
|
|
946
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
947
|
-
)
|
|
948
|
-
)
|
|
949
|
-
),
|
|
950
|
-
cache=Cache.REDIS,
|
|
951
|
-
serializer=JsonSerializer(),
|
|
952
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
953
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
954
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
955
|
-
db=self.service_manager.configs.cache.redis.db
|
|
956
|
-
)
|
|
957
765
|
async def _impl(
|
|
958
766
|
parameters:MaleoIdentityUserOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
959
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
767
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
768
|
+
authorization:Optional[Authorization] = None,
|
|
769
|
+
headers:Optional[Dict[str, str]] = None
|
|
960
770
|
):
|
|
961
771
|
#* Validate chosen controller type
|
|
962
772
|
if not isinstance(
|
|
@@ -973,7 +783,11 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
973
783
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
974
784
|
controller_result = (
|
|
975
785
|
await self._controllers.http
|
|
976
|
-
.get_user_organization_role(
|
|
786
|
+
.get_user_organization_role(
|
|
787
|
+
parameters=parameters,
|
|
788
|
+
authorization=authorization,
|
|
789
|
+
headers=headers
|
|
790
|
+
)
|
|
977
791
|
)
|
|
978
792
|
else:
|
|
979
793
|
message = "Invalid controller type"
|
|
@@ -988,16 +802,16 @@ class MaleoIdentityUserClientService(MaleoClientService):
|
|
|
988
802
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
989
803
|
.Fail
|
|
990
804
|
.model_validate(controller_result.content)
|
|
991
|
-
.model_dump(mode="json")
|
|
992
805
|
)
|
|
993
806
|
else:
|
|
994
807
|
return (
|
|
995
808
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
996
809
|
.SingleData
|
|
997
810
|
.model_validate(controller_result.content)
|
|
998
|
-
.model_dump(mode="json")
|
|
999
811
|
)
|
|
1000
812
|
return await _impl(
|
|
1001
813
|
parameters=parameters,
|
|
1002
|
-
controller_type=controller_type
|
|
814
|
+
controller_type=controller_type,
|
|
815
|
+
authorization=authorization,
|
|
816
|
+
headers=headers
|
|
1003
817
|
)
|