maleo-identity 0.0.55__py3-none-any.whl → 0.0.59__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.59.dist-info}/METADATA +3 -3
- {maleo_identity-0.0.55.dist-info → maleo_identity-0.0.59.dist-info}/RECORD +41 -41
- {maleo_identity-0.0.55.dist-info → maleo_identity-0.0.59.dist-info}/WHEEL +0 -0
- {maleo_identity-0.0.55.dist-info → maleo_identity-0.0.59.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 MaleoIdentityOrganizationControllers
|
|
9
6
|
from maleo_identity.enums.general import MaleoIdentityGeneralEnums
|
|
@@ -58,7 +55,9 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
58
55
|
async def get_organizations(
|
|
59
56
|
self,
|
|
60
57
|
parameters:MaleoIdentityOrganizationClientParametersTransfers.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
|
) -> MaleoIdentityOrganizationClientResultsTypes.GetMultiple:
|
|
63
62
|
"""Retrieve organizations from MaleoIdentity"""
|
|
64
63
|
@BaseExceptions.service_exception_handler(
|
|
@@ -66,40 +65,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
66
65
|
logger=self._logger,
|
|
67
66
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
68
67
|
)
|
|
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_30MN),
|
|
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
|
-
# 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:MaleoIdentityOrganizationClientParametersTransfers.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 MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
116
86
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
117
87
|
controller_result = (
|
|
118
88
|
await self._controllers.http
|
|
119
|
-
.get_organizations(
|
|
89
|
+
.get_organizations(
|
|
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 MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
131
105
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
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 MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
139
112
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
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
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
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_structured_organizations(
|
|
157
130
|
self,
|
|
158
131
|
parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleStructured,
|
|
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
|
) -> MaleoIdentityOrganizationClientResultsTypes.GetMultipleStructured:
|
|
161
136
|
"""Retrieve structured organizations from MaleoIdentity"""
|
|
162
137
|
@BaseExceptions.service_exception_handler(
|
|
@@ -164,40 +139,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
164
139
|
logger=self._logger,
|
|
165
140
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
166
141
|
)
|
|
167
|
-
# @BaseClientUtils.result_processor(
|
|
168
|
-
# fail_class=MaleoIdentityOrganizationClientResultsTransfers.Fail,
|
|
169
|
-
# data_found_class=MaleoIdentityOrganizationClientResultsTransfers.MultipleStructured,
|
|
170
|
-
# no_data_class=MaleoIdentityOrganizationClientResultsTransfers.NoData
|
|
171
|
-
# )
|
|
172
|
-
# @cached(
|
|
173
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_1WK),
|
|
174
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
175
|
-
# "organization",
|
|
176
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
177
|
-
# base_override=self.key
|
|
178
|
-
# ),
|
|
179
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
180
|
-
# skip_cache_func=lambda x: (
|
|
181
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
182
|
-
# or x is None
|
|
183
|
-
# or (
|
|
184
|
-
# isinstance(x, dict)
|
|
185
|
-
# and (
|
|
186
|
-
# x.get("success") in [False, None]
|
|
187
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
188
|
-
# )
|
|
189
|
-
# )
|
|
190
|
-
# ),
|
|
191
|
-
# cache=Cache.REDIS,
|
|
192
|
-
# serializer=JsonSerializer(),
|
|
193
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
194
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
195
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
196
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
197
|
-
# )
|
|
198
142
|
async def _impl(
|
|
199
143
|
parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleStructured,
|
|
200
|
-
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
|
|
201
147
|
):
|
|
202
148
|
#* Validate chosen controller type
|
|
203
149
|
if not isinstance(
|
|
@@ -214,7 +160,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
214
160
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
215
161
|
controller_result = (
|
|
216
162
|
await self._controllers.http
|
|
217
|
-
.get_structured_organizations(
|
|
163
|
+
.get_structured_organizations(
|
|
164
|
+
parameters=parameters,
|
|
165
|
+
authorization=authorization,
|
|
166
|
+
headers=headers
|
|
167
|
+
)
|
|
218
168
|
)
|
|
219
169
|
else:
|
|
220
170
|
message = "Invalid controller type"
|
|
@@ -229,7 +179,6 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
229
179
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
230
180
|
.Fail
|
|
231
181
|
.model_validate(controller_result.content)
|
|
232
|
-
# .model_dump(mode="json")
|
|
233
182
|
)
|
|
234
183
|
else:
|
|
235
184
|
if controller_result.content["data"] is None:
|
|
@@ -237,24 +186,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
237
186
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
238
187
|
.NoData
|
|
239
188
|
.model_validate(controller_result.content)
|
|
240
|
-
# .model_dump(mode="json")
|
|
241
189
|
)
|
|
242
190
|
else:
|
|
243
191
|
return (
|
|
244
192
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
245
193
|
.MultipleStructured
|
|
246
194
|
.model_validate(controller_result.content)
|
|
247
|
-
# .model_dump(mode="json")
|
|
248
195
|
)
|
|
249
196
|
return await _impl(
|
|
250
197
|
parameters=parameters,
|
|
251
|
-
controller_type=controller_type
|
|
198
|
+
controller_type=controller_type,
|
|
199
|
+
authorization=authorization,
|
|
200
|
+
headers=headers
|
|
252
201
|
)
|
|
253
202
|
|
|
254
203
|
async def get_organization(
|
|
255
204
|
self,
|
|
256
205
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
|
|
257
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
206
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
207
|
+
authorization:Optional[Authorization] = None,
|
|
208
|
+
headers:Optional[Dict[str, str]] = None
|
|
258
209
|
) -> MaleoIdentityOrganizationClientResultsTypes.GetSingle:
|
|
259
210
|
"""Retrieve organization from MaleoIdentity"""
|
|
260
211
|
@BaseExceptions.service_exception_handler(
|
|
@@ -262,39 +213,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
262
213
|
logger=self._logger,
|
|
263
214
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
264
215
|
)
|
|
265
|
-
@BaseClientUtils.result_processor(
|
|
266
|
-
fail_class=MaleoIdentityOrganizationClientResultsTransfers.Fail,
|
|
267
|
-
data_found_class=MaleoIdentityOrganizationClientResultsTransfers.SingleData
|
|
268
|
-
)
|
|
269
|
-
@cached(
|
|
270
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
271
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
272
|
-
"organization",
|
|
273
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
274
|
-
base_override=self.key
|
|
275
|
-
),
|
|
276
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
277
|
-
skip_cache_func=lambda x: (
|
|
278
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
279
|
-
or x is None
|
|
280
|
-
or (
|
|
281
|
-
isinstance(x, dict)
|
|
282
|
-
and (
|
|
283
|
-
x.get("success") in [False, None]
|
|
284
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
285
|
-
)
|
|
286
|
-
)
|
|
287
|
-
),
|
|
288
|
-
cache=Cache.REDIS,
|
|
289
|
-
serializer=JsonSerializer(),
|
|
290
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
291
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
292
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
293
|
-
db=self.service_manager.configs.cache.redis.db
|
|
294
|
-
)
|
|
295
216
|
async def _impl(
|
|
296
217
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
|
|
297
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
218
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
219
|
+
authorization:Optional[Authorization] = None,
|
|
220
|
+
headers:Optional[Dict[str, str]] = None
|
|
298
221
|
):
|
|
299
222
|
#* Validate chosen controller type
|
|
300
223
|
if not isinstance(
|
|
@@ -311,7 +234,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
311
234
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
312
235
|
controller_result = (
|
|
313
236
|
await self._controllers.http
|
|
314
|
-
.get_organization(
|
|
237
|
+
.get_organization(
|
|
238
|
+
parameters=parameters,
|
|
239
|
+
authorization=authorization,
|
|
240
|
+
headers=headers
|
|
241
|
+
)
|
|
315
242
|
)
|
|
316
243
|
else:
|
|
317
244
|
message = "Invalid controller type"
|
|
@@ -326,24 +253,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
326
253
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
327
254
|
.Fail
|
|
328
255
|
.model_validate(controller_result.content)
|
|
329
|
-
.model_dump(mode="json")
|
|
330
256
|
)
|
|
331
257
|
else:
|
|
332
258
|
return (
|
|
333
259
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
334
260
|
.SingleData
|
|
335
261
|
.model_validate(controller_result.content)
|
|
336
|
-
.model_dump(mode="json")
|
|
337
262
|
)
|
|
338
263
|
return await _impl(
|
|
339
264
|
parameters=parameters,
|
|
340
|
-
controller_type=controller_type
|
|
265
|
+
controller_type=controller_type,
|
|
266
|
+
authorization=authorization,
|
|
267
|
+
headers=headers
|
|
341
268
|
)
|
|
342
269
|
|
|
343
270
|
async def get_structured_organization(
|
|
344
271
|
self,
|
|
345
272
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
|
|
346
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
273
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
274
|
+
authorization:Optional[Authorization] = None,
|
|
275
|
+
headers:Optional[Dict[str, str]] = None
|
|
347
276
|
) -> MaleoIdentityOrganizationClientResultsTypes.GetSingleStructured:
|
|
348
277
|
"""Retrieve structured organization from MaleoIdentity"""
|
|
349
278
|
@BaseExceptions.service_exception_handler(
|
|
@@ -351,39 +280,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
351
280
|
logger=self._logger,
|
|
352
281
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
353
282
|
)
|
|
354
|
-
@BaseClientUtils.result_processor(
|
|
355
|
-
fail_class=MaleoIdentityOrganizationClientResultsTransfers.Fail,
|
|
356
|
-
data_found_class=MaleoIdentityOrganizationClientResultsTransfers.SingleStructured
|
|
357
|
-
)
|
|
358
|
-
@cached(
|
|
359
|
-
ttl=int(BaseEnums.CacheTTL.TTL_1WK),
|
|
360
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
361
|
-
"organization",
|
|
362
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
363
|
-
base_override=self.key
|
|
364
|
-
),
|
|
365
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
366
|
-
skip_cache_func=lambda x: (
|
|
367
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
368
|
-
or x is None
|
|
369
|
-
or (
|
|
370
|
-
isinstance(x, dict)
|
|
371
|
-
and (
|
|
372
|
-
x.get("success") in [False, None]
|
|
373
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
374
|
-
)
|
|
375
|
-
)
|
|
376
|
-
),
|
|
377
|
-
cache=Cache.REDIS,
|
|
378
|
-
serializer=JsonSerializer(),
|
|
379
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
380
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
381
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
382
|
-
db=self.service_manager.configs.cache.redis.db
|
|
383
|
-
)
|
|
384
283
|
async def _impl(
|
|
385
284
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.GetSingle,
|
|
386
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
285
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
286
|
+
authorization:Optional[Authorization] = None,
|
|
287
|
+
headers:Optional[Dict[str, str]] = None
|
|
387
288
|
):
|
|
388
289
|
#* Validate chosen controller type
|
|
389
290
|
if not isinstance(
|
|
@@ -400,7 +301,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
400
301
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
401
302
|
controller_result = (
|
|
402
303
|
await self._controllers.http
|
|
403
|
-
.get_structured_organization(
|
|
304
|
+
.get_structured_organization(
|
|
305
|
+
parameters=parameters,
|
|
306
|
+
authorization=authorization,
|
|
307
|
+
headers=headers
|
|
308
|
+
)
|
|
404
309
|
)
|
|
405
310
|
else:
|
|
406
311
|
message = "Invalid controller type"
|
|
@@ -415,24 +320,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
415
320
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
416
321
|
.Fail
|
|
417
322
|
.model_validate(controller_result.content)
|
|
418
|
-
.model_dump(mode="json")
|
|
419
323
|
)
|
|
420
324
|
else:
|
|
421
325
|
return (
|
|
422
326
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
423
327
|
.SingleStructured
|
|
424
328
|
.model_validate(controller_result.content)
|
|
425
|
-
.model_dump(mode="json")
|
|
426
329
|
)
|
|
427
330
|
return await _impl(
|
|
428
331
|
parameters=parameters,
|
|
429
|
-
controller_type=controller_type
|
|
332
|
+
controller_type=controller_type,
|
|
333
|
+
authorization=authorization,
|
|
334
|
+
headers=headers
|
|
430
335
|
)
|
|
431
336
|
|
|
432
337
|
async def get_organization_children(
|
|
433
338
|
self,
|
|
434
339
|
parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleChildren,
|
|
435
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
340
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
341
|
+
authorization:Optional[Authorization] = None,
|
|
342
|
+
headers:Optional[Dict[str, str]] = None
|
|
436
343
|
) -> MaleoIdentityOrganizationClientResultsTypes.GetMultiple:
|
|
437
344
|
"""Retrieve organization's children from MaleoIdentity"""
|
|
438
345
|
@BaseExceptions.service_exception_handler(
|
|
@@ -440,39 +347,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
440
347
|
logger=self._logger,
|
|
441
348
|
fail_result_class=MaleoIdentityOrganizationClientResultsTransfers.Fail
|
|
442
349
|
)
|
|
443
|
-
@BaseClientUtils.result_processor(
|
|
444
|
-
fail_class=MaleoIdentityOrganizationClientResultsTransfers.Fail,
|
|
445
|
-
data_found_class=MaleoIdentityOrganizationClientResultsTransfers.MultipleData
|
|
446
|
-
)
|
|
447
|
-
@cached(
|
|
448
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
449
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
450
|
-
"organization",
|
|
451
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
452
|
-
base_override=self.key
|
|
453
|
-
),
|
|
454
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
455
|
-
skip_cache_func=lambda x: (
|
|
456
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
457
|
-
or x is None
|
|
458
|
-
or (
|
|
459
|
-
isinstance(x, dict)
|
|
460
|
-
and (
|
|
461
|
-
x.get("success") in [False, None]
|
|
462
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
463
|
-
)
|
|
464
|
-
)
|
|
465
|
-
),
|
|
466
|
-
cache=Cache.REDIS,
|
|
467
|
-
serializer=JsonSerializer(),
|
|
468
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
469
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
470
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
471
|
-
db=self.service_manager.configs.cache.redis.db
|
|
472
|
-
)
|
|
473
350
|
async def _impl(
|
|
474
351
|
parameters:MaleoIdentityOrganizationClientParametersTransfers.GetMultipleChildren,
|
|
475
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
352
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
353
|
+
authorization:Optional[Authorization] = None,
|
|
354
|
+
headers:Optional[Dict[str, str]] = None
|
|
476
355
|
):
|
|
477
356
|
#* Validate chosen controller type
|
|
478
357
|
if not isinstance(
|
|
@@ -489,7 +368,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
489
368
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
490
369
|
controller_result = (
|
|
491
370
|
await self._controllers.http
|
|
492
|
-
.get_organization_children(
|
|
371
|
+
.get_organization_children(
|
|
372
|
+
parameters=parameters,
|
|
373
|
+
authorization=authorization,
|
|
374
|
+
headers=headers
|
|
375
|
+
)
|
|
493
376
|
)
|
|
494
377
|
else:
|
|
495
378
|
message = "Invalid controller type"
|
|
@@ -504,7 +387,6 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
504
387
|
MaleoIdentityOrganizationClientResultsTransfers
|
|
505
388
|
.Fail
|
|
506
389
|
.model_validate(controller_result.content)
|
|
507
|
-
.model_dump(mode="json")
|
|
508
390
|
)
|
|
509
391
|
else:
|
|
510
392
|
if controller_result.content["data"] is None:
|
|
@@ -523,13 +405,17 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
523
405
|
)
|
|
524
406
|
return await _impl(
|
|
525
407
|
parameters=parameters,
|
|
526
|
-
controller_type=controller_type
|
|
408
|
+
controller_type=controller_type,
|
|
409
|
+
authorization=authorization,
|
|
410
|
+
headers=headers
|
|
527
411
|
)
|
|
528
412
|
|
|
529
413
|
async def create(
|
|
530
414
|
self,
|
|
531
415
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Create,
|
|
532
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
416
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
417
|
+
authorization:Optional[Authorization] = None,
|
|
418
|
+
headers:Optional[Dict[str, str]] = None
|
|
533
419
|
) -> MaleoIdentityOrganizationClientResultsTypes.CreateOrUpdate:
|
|
534
420
|
"""Create a new organization in MaleoIdentity"""
|
|
535
421
|
@BaseExceptions.service_exception_handler(
|
|
@@ -539,7 +425,9 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
539
425
|
)
|
|
540
426
|
async def _impl(
|
|
541
427
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Create,
|
|
542
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
428
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
429
|
+
authorization:Optional[Authorization] = None,
|
|
430
|
+
headers:Optional[Dict[str, str]] = None
|
|
543
431
|
):
|
|
544
432
|
#* Validate chosen controller type
|
|
545
433
|
if not isinstance(
|
|
@@ -556,7 +444,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
556
444
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
557
445
|
controller_result = (
|
|
558
446
|
await self._controllers.http
|
|
559
|
-
.create(
|
|
447
|
+
.create(
|
|
448
|
+
parameters=parameters,
|
|
449
|
+
authorization=authorization,
|
|
450
|
+
headers=headers
|
|
451
|
+
)
|
|
560
452
|
)
|
|
561
453
|
else:
|
|
562
454
|
message = "Invalid controller type"
|
|
@@ -580,13 +472,17 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
580
472
|
)
|
|
581
473
|
return await _impl(
|
|
582
474
|
parameters=parameters,
|
|
583
|
-
controller_type=controller_type
|
|
475
|
+
controller_type=controller_type,
|
|
476
|
+
authorization=authorization,
|
|
477
|
+
headers=headers
|
|
584
478
|
)
|
|
585
479
|
|
|
586
480
|
async def update(
|
|
587
481
|
self,
|
|
588
482
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Update,
|
|
589
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
483
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
484
|
+
authorization:Optional[Authorization] = None,
|
|
485
|
+
headers:Optional[Dict[str, str]] = None
|
|
590
486
|
) -> MaleoIdentityOrganizationClientResultsTypes.CreateOrUpdate:
|
|
591
487
|
"""Update organization's data in MaleoIdentity"""
|
|
592
488
|
@BaseExceptions.service_exception_handler(
|
|
@@ -596,7 +492,9 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
596
492
|
)
|
|
597
493
|
async def _impl(
|
|
598
494
|
parameters:MaleoIdentityOrganizationGeneralParametersTransfers.Update,
|
|
599
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
495
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
496
|
+
authorization:Optional[Authorization] = None,
|
|
497
|
+
headers:Optional[Dict[str, str]] = None
|
|
600
498
|
):
|
|
601
499
|
#* Validate chosen controller type
|
|
602
500
|
if not isinstance(
|
|
@@ -613,7 +511,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
613
511
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
614
512
|
controller_result = (
|
|
615
513
|
await self._controllers.http
|
|
616
|
-
.update(
|
|
514
|
+
.update(
|
|
515
|
+
parameters=parameters,
|
|
516
|
+
authorization=authorization,
|
|
517
|
+
headers=headers
|
|
518
|
+
)
|
|
617
519
|
)
|
|
618
520
|
else:
|
|
619
521
|
message = "Invalid controller type"
|
|
@@ -637,13 +539,17 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
637
539
|
)
|
|
638
540
|
return await _impl(
|
|
639
541
|
parameters=parameters,
|
|
640
|
-
controller_type=controller_type
|
|
542
|
+
controller_type=controller_type,
|
|
543
|
+
authorization=authorization,
|
|
544
|
+
headers=headers
|
|
641
545
|
)
|
|
642
546
|
|
|
643
547
|
async def get_organization_users(
|
|
644
548
|
self,
|
|
645
549
|
parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromOrganization,
|
|
646
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
550
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
551
|
+
authorization:Optional[Authorization] = None,
|
|
552
|
+
headers:Optional[Dict[str, str]] = None
|
|
647
553
|
) -> MaleoIdentityUserOrganizationClientResultsTypes.GetMultiple:
|
|
648
554
|
"""Retrieve organization's users from MaleoIdentity"""
|
|
649
555
|
@BaseExceptions.service_exception_handler(
|
|
@@ -651,40 +557,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
651
557
|
logger=self._logger,
|
|
652
558
|
fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
|
|
653
559
|
)
|
|
654
|
-
# @BaseClientUtils.result_processor(
|
|
655
|
-
# fail_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail,
|
|
656
|
-
# data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.MultipleData,
|
|
657
|
-
# no_data_class=MaleoIdentityUserOrganizationClientResultsTransfers.NoData
|
|
658
|
-
# )
|
|
659
|
-
# @cached(
|
|
660
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
661
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
662
|
-
# "organization_user",
|
|
663
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
664
|
-
# base_override=self.key
|
|
665
|
-
# ),
|
|
666
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
667
|
-
# skip_cache_func=lambda x: (
|
|
668
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
669
|
-
# or x is None
|
|
670
|
-
# or (
|
|
671
|
-
# isinstance(x, dict)
|
|
672
|
-
# and (
|
|
673
|
-
# x.get("success") in [False, None]
|
|
674
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
675
|
-
# )
|
|
676
|
-
# )
|
|
677
|
-
# ),
|
|
678
|
-
# cache=Cache.REDIS,
|
|
679
|
-
# serializer=JsonSerializer(),
|
|
680
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
681
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
682
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
683
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
684
|
-
# )
|
|
685
560
|
async def _impl(
|
|
686
561
|
parameters:MaleoIdentityUserOrganizationClientParametersTransfers.GetMultipleFromOrganization,
|
|
687
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
562
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
563
|
+
authorization:Optional[Authorization] = None,
|
|
564
|
+
headers:Optional[Dict[str, str]] = None
|
|
688
565
|
):
|
|
689
566
|
#* Validate chosen controller type
|
|
690
567
|
if not isinstance(
|
|
@@ -701,7 +578,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
701
578
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
702
579
|
controller_result = (
|
|
703
580
|
await self._controllers.http
|
|
704
|
-
.get_organization_users(
|
|
581
|
+
.get_organization_users(
|
|
582
|
+
parameters=parameters,
|
|
583
|
+
authorization=authorization,
|
|
584
|
+
headers=headers
|
|
585
|
+
)
|
|
705
586
|
)
|
|
706
587
|
else:
|
|
707
588
|
message = "Invalid controller type"
|
|
@@ -716,7 +597,6 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
716
597
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
717
598
|
.Fail
|
|
718
599
|
.model_validate(controller_result.content)
|
|
719
|
-
# .model_dump(mode="json")
|
|
720
600
|
)
|
|
721
601
|
else:
|
|
722
602
|
if controller_result.content["data"] is None:
|
|
@@ -724,24 +604,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
724
604
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
725
605
|
.NoData
|
|
726
606
|
.model_validate(controller_result.content)
|
|
727
|
-
# .model_dump(mode="json")
|
|
728
607
|
)
|
|
729
608
|
else:
|
|
730
609
|
return (
|
|
731
610
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
732
611
|
.MultipleData
|
|
733
612
|
.model_validate(controller_result.content)
|
|
734
|
-
# .model_dump(mode="json")
|
|
735
613
|
)
|
|
736
614
|
return await _impl(
|
|
737
615
|
parameters=parameters,
|
|
738
|
-
controller_type=controller_type
|
|
616
|
+
controller_type=controller_type,
|
|
617
|
+
authorization=authorization,
|
|
618
|
+
headers=headers
|
|
739
619
|
)
|
|
740
620
|
|
|
741
621
|
async def get_organization_user(
|
|
742
622
|
self,
|
|
743
623
|
parameters:MaleoIdentityUserOrganizationGeneralParametersTransfers.GetSingle,
|
|
744
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
624
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
625
|
+
authorization:Optional[Authorization] = None,
|
|
626
|
+
headers:Optional[Dict[str, str]] = None
|
|
745
627
|
) -> MaleoIdentityUserOrganizationClientResultsTypes.GetSingle:
|
|
746
628
|
"""Retrieve organization's user from MaleoIdentity"""
|
|
747
629
|
@BaseExceptions.service_exception_handler(
|
|
@@ -749,39 +631,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
749
631
|
logger=self._logger,
|
|
750
632
|
fail_result_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail
|
|
751
633
|
)
|
|
752
|
-
@BaseClientUtils.result_processor(
|
|
753
|
-
fail_class=MaleoIdentityUserOrganizationClientResultsTransfers.Fail,
|
|
754
|
-
data_found_class=MaleoIdentityUserOrganizationClientResultsTransfers.SingleData
|
|
755
|
-
)
|
|
756
|
-
@cached(
|
|
757
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
758
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
759
|
-
"user_organization",
|
|
760
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
761
|
-
base_override=self.key
|
|
762
|
-
),
|
|
763
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
764
|
-
skip_cache_func=lambda x: (
|
|
765
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
766
|
-
or x is None
|
|
767
|
-
or (
|
|
768
|
-
isinstance(x, dict)
|
|
769
|
-
and (
|
|
770
|
-
x.get("success") in [False, None]
|
|
771
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
772
|
-
)
|
|
773
|
-
)
|
|
774
|
-
),
|
|
775
|
-
cache=Cache.REDIS,
|
|
776
|
-
serializer=JsonSerializer(),
|
|
777
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
778
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
779
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
780
|
-
db=self.service_manager.configs.cache.redis.db
|
|
781
|
-
)
|
|
782
634
|
async def _impl(
|
|
783
635
|
parameters:MaleoIdentityUserOrganizationGeneralParametersTransfers.GetSingle,
|
|
784
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
636
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
637
|
+
authorization:Optional[Authorization] = None,
|
|
638
|
+
headers:Optional[Dict[str, str]] = None
|
|
785
639
|
):
|
|
786
640
|
#* Validate chosen controller type
|
|
787
641
|
if not isinstance(
|
|
@@ -798,7 +652,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
798
652
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
799
653
|
controller_result = (
|
|
800
654
|
await self._controllers.http
|
|
801
|
-
.get_organization_user(
|
|
655
|
+
.get_organization_user(
|
|
656
|
+
parameters=parameters,
|
|
657
|
+
authorization=authorization,
|
|
658
|
+
headers=headers
|
|
659
|
+
)
|
|
802
660
|
)
|
|
803
661
|
else:
|
|
804
662
|
message = "Invalid controller type"
|
|
@@ -813,24 +671,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
813
671
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
814
672
|
.Fail
|
|
815
673
|
.model_validate(controller_result.content)
|
|
816
|
-
.model_dump(mode="json")
|
|
817
674
|
)
|
|
818
675
|
else:
|
|
819
676
|
return (
|
|
820
677
|
MaleoIdentityUserOrganizationClientResultsTransfers
|
|
821
678
|
.SingleData
|
|
822
679
|
.model_validate(controller_result.content)
|
|
823
|
-
.model_dump(mode="json")
|
|
824
680
|
)
|
|
825
681
|
return await _impl(
|
|
826
682
|
parameters=parameters,
|
|
827
|
-
controller_type=controller_type
|
|
683
|
+
controller_type=controller_type,
|
|
684
|
+
authorization=authorization,
|
|
685
|
+
headers=headers
|
|
828
686
|
)
|
|
829
687
|
|
|
830
688
|
async def get_organization_roles(
|
|
831
689
|
self,
|
|
832
690
|
parameters:MaleoIdentityOrganizationRoleClientParametersTransfers.GetMultipleFromOrganization,
|
|
833
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
691
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
692
|
+
authorization:Optional[Authorization] = None,
|
|
693
|
+
headers:Optional[Dict[str, str]] = None
|
|
834
694
|
) -> MaleoIdentityOrganizationRoleClientResultsTypes.GetMultiple:
|
|
835
695
|
"""Retrieve organization's roles from MaleoIdentity"""
|
|
836
696
|
@BaseExceptions.service_exception_handler(
|
|
@@ -838,40 +698,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
838
698
|
logger=self._logger,
|
|
839
699
|
fail_result_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail
|
|
840
700
|
)
|
|
841
|
-
# @BaseClientUtils.result_processor(
|
|
842
|
-
# fail_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail,
|
|
843
|
-
# data_found_class=MaleoIdentityOrganizationRoleClientResultsTransfers.MultipleData,
|
|
844
|
-
# no_data_class=MaleoIdentityOrganizationRoleClientResultsTransfers.NoData
|
|
845
|
-
# )
|
|
846
|
-
# @cached(
|
|
847
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
848
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
849
|
-
# "organization_role",
|
|
850
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
851
|
-
# base_override=self.key
|
|
852
|
-
# ),
|
|
853
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
854
|
-
# skip_cache_func=lambda x: (
|
|
855
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
856
|
-
# or x is None
|
|
857
|
-
# or (
|
|
858
|
-
# isinstance(x, dict)
|
|
859
|
-
# and (
|
|
860
|
-
# x.get("success") in [False, None]
|
|
861
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
862
|
-
# )
|
|
863
|
-
# )
|
|
864
|
-
# ),
|
|
865
|
-
# cache=Cache.REDIS,
|
|
866
|
-
# serializer=JsonSerializer(),
|
|
867
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
868
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
869
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
870
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
871
|
-
# )
|
|
872
701
|
async def _impl(
|
|
873
702
|
parameters:MaleoIdentityOrganizationRoleClientParametersTransfers.GetMultipleFromOrganization,
|
|
874
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
703
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
704
|
+
authorization:Optional[Authorization] = None,
|
|
705
|
+
headers:Optional[Dict[str, str]] = None
|
|
875
706
|
):
|
|
876
707
|
#* Validate chosen controller type
|
|
877
708
|
if not isinstance(
|
|
@@ -888,7 +719,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
888
719
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
889
720
|
controller_result = (
|
|
890
721
|
await self._controllers.http
|
|
891
|
-
.get_organization_roles(
|
|
722
|
+
.get_organization_roles(
|
|
723
|
+
parameters=parameters,
|
|
724
|
+
authorization=authorization,
|
|
725
|
+
headers=headers
|
|
726
|
+
)
|
|
892
727
|
)
|
|
893
728
|
else:
|
|
894
729
|
message = "Invalid controller type"
|
|
@@ -903,7 +738,6 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
903
738
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
904
739
|
.Fail
|
|
905
740
|
.model_validate(controller_result.content)
|
|
906
|
-
# .model_dump(mode="json")
|
|
907
741
|
)
|
|
908
742
|
else:
|
|
909
743
|
if controller_result.content["data"] is None:
|
|
@@ -911,24 +745,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
911
745
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
912
746
|
.NoData
|
|
913
747
|
.model_validate(controller_result.content)
|
|
914
|
-
# .model_dump(mode="json")
|
|
915
748
|
)
|
|
916
749
|
else:
|
|
917
750
|
return (
|
|
918
751
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
919
752
|
.MultipleData
|
|
920
753
|
.model_validate(controller_result.content)
|
|
921
|
-
# .model_dump(mode="json")
|
|
922
754
|
)
|
|
923
755
|
return await _impl(
|
|
924
756
|
parameters=parameters,
|
|
925
|
-
controller_type=controller_type
|
|
757
|
+
controller_type=controller_type,
|
|
758
|
+
authorization=authorization,
|
|
759
|
+
headers=headers
|
|
926
760
|
)
|
|
927
761
|
|
|
928
762
|
async def get_organization_role(
|
|
929
763
|
self,
|
|
930
764
|
parameters:MaleoIdentityOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
931
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
765
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
766
|
+
authorization:Optional[Authorization] = None,
|
|
767
|
+
headers:Optional[Dict[str, str]] = None
|
|
932
768
|
) -> MaleoIdentityOrganizationRoleClientResultsTypes.GetSingle:
|
|
933
769
|
"""Retrieve organization's role from MaleoIdentity"""
|
|
934
770
|
@BaseExceptions.service_exception_handler(
|
|
@@ -936,39 +772,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
936
772
|
logger=self._logger,
|
|
937
773
|
fail_result_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail
|
|
938
774
|
)
|
|
939
|
-
@BaseClientUtils.result_processor(
|
|
940
|
-
fail_class=MaleoIdentityOrganizationRoleClientResultsTransfers.Fail,
|
|
941
|
-
data_found_class=MaleoIdentityOrganizationRoleClientResultsTransfers.SingleData
|
|
942
|
-
)
|
|
943
|
-
@cached(
|
|
944
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
945
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
946
|
-
"organization_role",
|
|
947
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
948
|
-
base_override=self.key
|
|
949
|
-
),
|
|
950
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
951
|
-
skip_cache_func=lambda x: (
|
|
952
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
953
|
-
or x is None
|
|
954
|
-
or (
|
|
955
|
-
isinstance(x, dict)
|
|
956
|
-
and (
|
|
957
|
-
x.get("success") in [False, None]
|
|
958
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
959
|
-
)
|
|
960
|
-
)
|
|
961
|
-
),
|
|
962
|
-
cache=Cache.REDIS,
|
|
963
|
-
serializer=JsonSerializer(),
|
|
964
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
965
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
966
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
967
|
-
db=self.service_manager.configs.cache.redis.db
|
|
968
|
-
)
|
|
969
775
|
async def _impl(
|
|
970
776
|
parameters:MaleoIdentityOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
971
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
777
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
778
|
+
authorization:Optional[Authorization] = None,
|
|
779
|
+
headers:Optional[Dict[str, str]] = None
|
|
972
780
|
):
|
|
973
781
|
#* Validate chosen controller type
|
|
974
782
|
if not isinstance(
|
|
@@ -985,7 +793,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
985
793
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
986
794
|
controller_result = (
|
|
987
795
|
await self._controllers.http
|
|
988
|
-
.get_organization_role(
|
|
796
|
+
.get_organization_role(
|
|
797
|
+
parameters=parameters,
|
|
798
|
+
authorization=authorization,
|
|
799
|
+
headers=headers
|
|
800
|
+
)
|
|
989
801
|
)
|
|
990
802
|
else:
|
|
991
803
|
message = "Invalid controller type"
|
|
@@ -1000,24 +812,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1000
812
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
1001
813
|
.Fail
|
|
1002
814
|
.model_validate(controller_result.content)
|
|
1003
|
-
.model_dump(mode="json")
|
|
1004
815
|
)
|
|
1005
816
|
else:
|
|
1006
817
|
return (
|
|
1007
818
|
MaleoIdentityOrganizationRoleClientResultsTransfers
|
|
1008
819
|
.SingleData
|
|
1009
820
|
.model_validate(controller_result.content)
|
|
1010
|
-
.model_dump(mode="json")
|
|
1011
821
|
)
|
|
1012
822
|
return await _impl(
|
|
1013
823
|
parameters=parameters,
|
|
1014
|
-
controller_type=controller_type
|
|
824
|
+
controller_type=controller_type,
|
|
825
|
+
authorization=authorization,
|
|
826
|
+
headers=headers
|
|
1015
827
|
)
|
|
1016
828
|
|
|
1017
829
|
async def get_organization_user_roles(
|
|
1018
830
|
self,
|
|
1019
831
|
parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
|
|
1020
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
832
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
833
|
+
authorization:Optional[Authorization] = None,
|
|
834
|
+
headers:Optional[Dict[str, str]] = None
|
|
1021
835
|
) -> MaleoIdentityUserOrganizationRoleClientResultsTypes.GetMultiple:
|
|
1022
836
|
"""Retrieve organization's user roles from MaleoIdentity"""
|
|
1023
837
|
@BaseExceptions.service_exception_handler(
|
|
@@ -1025,40 +839,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1025
839
|
logger=self._logger,
|
|
1026
840
|
fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
|
|
1027
841
|
)
|
|
1028
|
-
# @BaseClientUtils.result_processor(
|
|
1029
|
-
# fail_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail,
|
|
1030
|
-
# data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.MultipleData,
|
|
1031
|
-
# no_data_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.NoData
|
|
1032
|
-
# )
|
|
1033
|
-
# @cached(
|
|
1034
|
-
# ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
1035
|
-
# namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
1036
|
-
# "user_organization_role",
|
|
1037
|
-
# type=BaseEnums.CacheType.CLIENT,
|
|
1038
|
-
# base_override=self.key
|
|
1039
|
-
# ),
|
|
1040
|
-
# key_builder=BaseCacheConfigurations.key_builder,
|
|
1041
|
-
# skip_cache_func=lambda x: (
|
|
1042
|
-
# self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
1043
|
-
# or x is None
|
|
1044
|
-
# or (
|
|
1045
|
-
# isinstance(x, dict)
|
|
1046
|
-
# and (
|
|
1047
|
-
# x.get("success") in [False, None]
|
|
1048
|
-
# or (x.get("success") is True and x.get("data") is None)
|
|
1049
|
-
# )
|
|
1050
|
-
# )
|
|
1051
|
-
# ),
|
|
1052
|
-
# cache=Cache.REDIS,
|
|
1053
|
-
# serializer=JsonSerializer(),
|
|
1054
|
-
# endpoint=self.service_manager.configs.cache.redis.host,
|
|
1055
|
-
# port=self.service_manager.configs.cache.redis.port,
|
|
1056
|
-
# password=self.service_manager.configs.cache.redis.password,
|
|
1057
|
-
# db=self.service_manager.configs.cache.redis.db
|
|
1058
|
-
# )
|
|
1059
842
|
async def _impl(
|
|
1060
843
|
parameters:MaleoIdentityUserOrganizationRoleClientParametersTransfers.GetMultipleFromUserOrOrganization,
|
|
1061
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
844
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
845
|
+
authorization:Optional[Authorization] = None,
|
|
846
|
+
headers:Optional[Dict[str, str]] = None
|
|
1062
847
|
):
|
|
1063
848
|
#* Validate chosen controller type
|
|
1064
849
|
if not isinstance(
|
|
@@ -1075,7 +860,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1075
860
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
1076
861
|
controller_result = (
|
|
1077
862
|
await self._controllers.http
|
|
1078
|
-
.get_organization_user_roles(
|
|
863
|
+
.get_organization_user_roles(
|
|
864
|
+
parameters=parameters,
|
|
865
|
+
authorization=authorization,
|
|
866
|
+
headers=headers
|
|
867
|
+
)
|
|
1079
868
|
)
|
|
1080
869
|
else:
|
|
1081
870
|
message = "Invalid controller type"
|
|
@@ -1090,7 +879,6 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1090
879
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
1091
880
|
.Fail
|
|
1092
881
|
.model_validate(controller_result.content)
|
|
1093
|
-
# .model_dump(mode="json")
|
|
1094
882
|
)
|
|
1095
883
|
else:
|
|
1096
884
|
if controller_result.content["data"] is None:
|
|
@@ -1098,24 +886,26 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1098
886
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
1099
887
|
.NoData
|
|
1100
888
|
.model_validate(controller_result.content)
|
|
1101
|
-
# .model_dump(mode="json")
|
|
1102
889
|
)
|
|
1103
890
|
else:
|
|
1104
891
|
return (
|
|
1105
892
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
1106
893
|
.MultipleData
|
|
1107
894
|
.model_validate(controller_result.content)
|
|
1108
|
-
# .model_dump(mode="json")
|
|
1109
895
|
)
|
|
1110
896
|
return await _impl(
|
|
1111
897
|
parameters=parameters,
|
|
1112
|
-
controller_type=controller_type
|
|
898
|
+
controller_type=controller_type,
|
|
899
|
+
authorization=authorization,
|
|
900
|
+
headers=headers
|
|
1113
901
|
)
|
|
1114
902
|
|
|
1115
903
|
async def get_organization_user_role(
|
|
1116
904
|
self,
|
|
1117
905
|
parameters:MaleoIdentityUserOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
1118
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
906
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
907
|
+
authorization:Optional[Authorization] = None,
|
|
908
|
+
headers:Optional[Dict[str, str]] = None
|
|
1119
909
|
) -> MaleoIdentityUserOrganizationRoleClientResultsTypes.GetSingle:
|
|
1120
910
|
"""Retrieve organization's user role from MaleoIdentity"""
|
|
1121
911
|
@BaseExceptions.service_exception_handler(
|
|
@@ -1123,39 +913,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1123
913
|
logger=self._logger,
|
|
1124
914
|
fail_result_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail
|
|
1125
915
|
)
|
|
1126
|
-
@BaseClientUtils.result_processor(
|
|
1127
|
-
fail_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.Fail,
|
|
1128
|
-
data_found_class=MaleoIdentityUserOrganizationRoleClientResultsTransfers.SingleData
|
|
1129
|
-
)
|
|
1130
|
-
@cached(
|
|
1131
|
-
ttl=int(BaseEnums.CacheTTL.TTL_30MN),
|
|
1132
|
-
namespace=self.service_manager.configs.cache.redis.namespaces.create(
|
|
1133
|
-
"user_organization_role",
|
|
1134
|
-
type=BaseEnums.CacheType.CLIENT,
|
|
1135
|
-
base_override=self.key
|
|
1136
|
-
),
|
|
1137
|
-
key_builder=BaseCacheConfigurations.key_builder,
|
|
1138
|
-
skip_cache_func=lambda x: (
|
|
1139
|
-
self.service_manager.settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL
|
|
1140
|
-
or x is None
|
|
1141
|
-
or (
|
|
1142
|
-
isinstance(x, dict)
|
|
1143
|
-
and (
|
|
1144
|
-
x.get("success") in [False, None]
|
|
1145
|
-
or (x.get("success") is True and x.get("data") is None)
|
|
1146
|
-
)
|
|
1147
|
-
)
|
|
1148
|
-
),
|
|
1149
|
-
cache=Cache.REDIS,
|
|
1150
|
-
serializer=JsonSerializer(),
|
|
1151
|
-
endpoint=self.service_manager.configs.cache.redis.host,
|
|
1152
|
-
port=self.service_manager.configs.cache.redis.port,
|
|
1153
|
-
password=self.service_manager.configs.cache.redis.password,
|
|
1154
|
-
db=self.service_manager.configs.cache.redis.db
|
|
1155
|
-
)
|
|
1156
916
|
async def _impl(
|
|
1157
917
|
parameters:MaleoIdentityUserOrganizationRoleGeneralParametersTransfers.GetSingle,
|
|
1158
|
-
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP
|
|
918
|
+
controller_type:MaleoIdentityGeneralEnums.ClientControllerType = MaleoIdentityGeneralEnums.ClientControllerType.HTTP,
|
|
919
|
+
authorization:Optional[Authorization] = None,
|
|
920
|
+
headers:Optional[Dict[str, str]] = None
|
|
1159
921
|
):
|
|
1160
922
|
#* Validate chosen controller type
|
|
1161
923
|
if not isinstance(
|
|
@@ -1172,7 +934,11 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1172
934
|
if controller_type == MaleoIdentityGeneralEnums.ClientControllerType.HTTP:
|
|
1173
935
|
controller_result = (
|
|
1174
936
|
await self._controllers.http
|
|
1175
|
-
.get_organization_user_role(
|
|
937
|
+
.get_organization_user_role(
|
|
938
|
+
parameters=parameters,
|
|
939
|
+
authorization=authorization,
|
|
940
|
+
headers=headers
|
|
941
|
+
)
|
|
1176
942
|
)
|
|
1177
943
|
else:
|
|
1178
944
|
message = "Invalid controller type"
|
|
@@ -1187,16 +953,16 @@ class MaleoIdentityOrganizationClientService(MaleoClientService):
|
|
|
1187
953
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
1188
954
|
.Fail
|
|
1189
955
|
.model_validate(controller_result.content)
|
|
1190
|
-
.model_dump(mode="json")
|
|
1191
956
|
)
|
|
1192
957
|
else:
|
|
1193
958
|
return (
|
|
1194
959
|
MaleoIdentityUserOrganizationRoleClientResultsTransfers
|
|
1195
960
|
.SingleData
|
|
1196
961
|
.model_validate(controller_result.content)
|
|
1197
|
-
.model_dump(mode="json")
|
|
1198
962
|
)
|
|
1199
963
|
return await _impl(
|
|
1200
964
|
parameters=parameters,
|
|
1201
|
-
controller_type=controller_type
|
|
965
|
+
controller_type=controller_type,
|
|
966
|
+
authorization=authorization,
|
|
967
|
+
headers=headers
|
|
1202
968
|
)
|