abs-auth-rbac-core 0.1.8__tar.gz → 0.1.10__tar.gz
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.
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/PKG-INFO +1 -1
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/rbac/service.py +15 -5
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/pyproject.toml +1 -1
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/README.md +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/__init__.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/auth/__init__.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/auth/auth_functions.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/auth/jwt_functions.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/auth/middleware.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/__init__.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/base_model.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/gov_casbin_rule.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/permissions.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/rbac_model.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/role_permission.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/roles.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/seeder/permission_seeder.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/user.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/user_permission.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/user_role.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/rbac/__init__.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/rbac/decorator.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/rbac/policy.conf +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/schema/__init__.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/schema/permission.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/util/__init__.py +0 -0
- {abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/util/permission_constants.py +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
|
|
@@ -816,6 +819,8 @@ class RBACService:
|
|
|
816
819
|
# Try with module first
|
|
817
820
|
if self.enforcer.enforce(role.uuid, resource, action, module):
|
|
818
821
|
return True
|
|
822
|
+
if self.enforcer.enforce(role.name, resource, action, module):
|
|
823
|
+
return True
|
|
819
824
|
return False
|
|
820
825
|
|
|
821
826
|
def check_permission_by_role(
|
|
@@ -825,6 +830,11 @@ class RBACService:
|
|
|
825
830
|
if self.enforcer.enforce(role_uuid, resource, action, module):
|
|
826
831
|
return True
|
|
827
832
|
return False
|
|
833
|
+
|
|
834
|
+
def check_permission_by_user(self,user_uuid:str,resource:str,action:str,module:str) -> bool:
|
|
835
|
+
if self.enforcer.enforce(f"user:{user_uuid}", resource, action, module):
|
|
836
|
+
return True
|
|
837
|
+
return False
|
|
828
838
|
|
|
829
839
|
def get_role(self, role_uuid: str,session: Optional[Session] = None) -> Any:
|
|
830
840
|
"""Get role by uuid"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/auth/auth_functions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/auth/jwt_functions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/auth/middleware.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/__init__.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/base_model.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/gov_casbin_rule.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/permissions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/rbac_model.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/role_permission.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/user_permission.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/models/user_role.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/schema/__init__.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.1.8 → abs_auth_rbac_core-0.1.10}/abs_auth_rbac_core/schema/permission.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|