abs-auth-rbac-core 0.1.7__py3-none-any.whl → 0.1.9__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 abs-auth-rbac-core might be problematic. Click here for more details.
- abs_auth_rbac_core/rbac/service.py +14 -6
- {abs_auth_rbac_core-0.1.7.dist-info → abs_auth_rbac_core-0.1.9.dist-info}/METADATA +1 -1
- {abs_auth_rbac_core-0.1.7.dist-info → abs_auth_rbac_core-0.1.9.dist-info}/RECORD +4 -4
- {abs_auth_rbac_core-0.1.7.dist-info → abs_auth_rbac_core-0.1.9.dist-info}/WHEEL +0 -0
|
@@ -174,8 +174,10 @@ class RBACService:
|
|
|
174
174
|
[f"user:{user_uuid}", permission.resource, permission.action, permission.module]
|
|
175
175
|
for permission in permissions
|
|
176
176
|
]
|
|
177
|
-
self.enforcer.add_policies(policies)
|
|
178
|
-
|
|
177
|
+
added_policies = self.enforcer.add_policies(policies)
|
|
178
|
+
if added_policies:
|
|
179
|
+
self.enforcer.save_policy()
|
|
180
|
+
self.enforcer.load_policy()
|
|
179
181
|
return user_permissions
|
|
180
182
|
|
|
181
183
|
|
|
@@ -191,9 +193,10 @@ class RBACService:
|
|
|
191
193
|
[f"user:{user_uuid}", permission.resource, permission.action, permission.module]
|
|
192
194
|
for permission in permissions
|
|
193
195
|
]
|
|
194
|
-
self.enforcer.remove_policies(policies)
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
removed_policies = self.enforcer.remove_policies(policies)
|
|
197
|
+
if removed_policies:
|
|
198
|
+
self.enforcer.save_policy()
|
|
199
|
+
self.enforcer.load_policy()
|
|
197
200
|
user_permissions.delete(synchronize_session=False)
|
|
198
201
|
session.commit()
|
|
199
202
|
return True
|
|
@@ -472,7 +475,7 @@ class RBACService:
|
|
|
472
475
|
for user_permission in user_permissions:
|
|
473
476
|
result.append(
|
|
474
477
|
{
|
|
475
|
-
"permission_id": user_permission.permission.
|
|
478
|
+
"permission_id": user_permission.permission.uuid,
|
|
476
479
|
"created_at": user_permission.permission.created_at,
|
|
477
480
|
"updated_at": user_permission.permission.updated_at,
|
|
478
481
|
"name": user_permission.permission.name,
|
|
@@ -825,6 +828,11 @@ class RBACService:
|
|
|
825
828
|
if self.enforcer.enforce(role_uuid, resource, action, module):
|
|
826
829
|
return True
|
|
827
830
|
return False
|
|
831
|
+
|
|
832
|
+
def check_permission_by_user(self,user_uuid:str,resource:str,action:str,module:str) -> bool:
|
|
833
|
+
if self.enforcer.enforce(f"user:{user_uuid}", resource, action, module):
|
|
834
|
+
return True
|
|
835
|
+
return False
|
|
828
836
|
|
|
829
837
|
def get_role(self, role_uuid: str,session: Optional[Session] = None) -> Any:
|
|
830
838
|
"""Get role by uuid"""
|
|
@@ -17,11 +17,11 @@ abs_auth_rbac_core/models/user_role.py,sha256=20pqmtJPzlUrI9ulHGouk8XlFgrGG7I6ik
|
|
|
17
17
|
abs_auth_rbac_core/rbac/__init__.py,sha256=oYjtpmfrkEbwWCBAWuRoU1fM4fCpBxkF_lwQrelK1As,79
|
|
18
18
|
abs_auth_rbac_core/rbac/decorator.py,sha256=pEFAW0Nn2iE4KBctPhNOmO_VLeJFDX2V9v2LsCu6kHY,1824
|
|
19
19
|
abs_auth_rbac_core/rbac/policy.conf,sha256=wghhhKxgZH0rPhh1QFrIpq9nevJT3s7OxxvXiU3zzuI,305
|
|
20
|
-
abs_auth_rbac_core/rbac/service.py,sha256=
|
|
20
|
+
abs_auth_rbac_core/rbac/service.py,sha256=Wb2U5O1ci-UEINYJea-430JevpT3NT7FjEB19vkiQg0,32598
|
|
21
21
|
abs_auth_rbac_core/schema/__init__.py,sha256=v9xibJ8Wr9k0u6PEYNK0LCGUJD71SB5vxu9BZG0S7tM,46
|
|
22
22
|
abs_auth_rbac_core/schema/permission.py,sha256=XvxPU68FY0PFgkF4GR2bSrzNvFB8c8OgY_d0JOJvMc8,203
|
|
23
23
|
abs_auth_rbac_core/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
abs_auth_rbac_core/util/permission_constants.py,sha256=ZADzQ31HQgLPS8oJXMbuSbm-2M30BERPWZppgvvg8Yg,70785
|
|
25
|
-
abs_auth_rbac_core-0.1.
|
|
26
|
-
abs_auth_rbac_core-0.1.
|
|
27
|
-
abs_auth_rbac_core-0.1.
|
|
25
|
+
abs_auth_rbac_core-0.1.9.dist-info/METADATA,sha256=QxtDuNjXi-1_l4NuAYYvxLa56KPneakZwgpskB-aTeI,6635
|
|
26
|
+
abs_auth_rbac_core-0.1.9.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
27
|
+
abs_auth_rbac_core-0.1.9.dist-info/RECORD,,
|
|
File without changes
|