abs-auth-rbac-core 0.3.9__tar.gz → 0.3.11__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.
Potentially problematic release.
This version of abs-auth-rbac-core might be problematic. Click here for more details.
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/PKG-INFO +4 -4
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/rbac/service.py +29 -11
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/util/permission_constants.py +10 -1
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/pyproject.toml +1 -1
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/README.md +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/auth/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/auth/auth_functions.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/auth/jwt_functions.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/auth/middleware.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/base_model.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/gov_casbin_rule.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/permissions.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/rbac_model.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/role_permission.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/roles.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/seeder/permission_seeder.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/user.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/user_permission.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/user_role.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/rbac/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/rbac/decorator.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/rbac/policy.conf +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/repository/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/repository/permission_repository.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/repository/role_repository.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/schema/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/schema/permission.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/service/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/service/permission_service.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/service/role_service.py +0 -0
- {abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/util/__init__.py +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: abs-auth-rbac-core
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.11
|
|
4
4
|
Summary: RBAC and Auth core utilities including JWT token management.
|
|
5
|
-
License
|
|
5
|
+
License: MIT
|
|
6
6
|
Author: AutoBridgeSystems
|
|
7
7
|
Author-email: info@autobridgesystems.com
|
|
8
8
|
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
10
|
Classifier: Programming Language :: Python :: 3
|
|
10
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
14
14
|
Requires-Dist: abs-exception-core (>=0.2.0,<0.3.0)
|
|
15
15
|
Requires-Dist: abs-repository-core (>=0.3.0,<0.4.0)
|
|
16
16
|
Requires-Dist: abs-utils (>=0.4.1,<0.5.0)
|
|
@@ -4,7 +4,7 @@ from pydantic import BaseModel
|
|
|
4
4
|
import casbin
|
|
5
5
|
from casbin_sqlalchemy_adapter import Adapter
|
|
6
6
|
from casbin_redis_watcher import RedisWatcher, WatcherOptions,new_watcher
|
|
7
|
-
from sqlalchemy import and_, select
|
|
7
|
+
from sqlalchemy import and_, or_, select
|
|
8
8
|
from sqlalchemy.orm import Session, joinedload
|
|
9
9
|
from ..schema import CreatePermissionSchema
|
|
10
10
|
from ..models import (
|
|
@@ -182,23 +182,41 @@ class RBACService:
|
|
|
182
182
|
except Exception as e:
|
|
183
183
|
raise e
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
def build_filter(self,cond: dict):
|
|
186
|
+
if "and" in cond:
|
|
187
|
+
return and_(*[self.build_filter(c) for c in cond["and"]])
|
|
188
|
+
elif "or" in cond:
|
|
189
|
+
return or_(*[self.build_filter(c) for c in cond["or"]])
|
|
190
|
+
else:
|
|
191
|
+
# Multiple simple field=value pairs in the same dict
|
|
192
|
+
return and_(*[
|
|
193
|
+
getattr(Permission, field) == value
|
|
194
|
+
for field, value in cond.items()
|
|
195
|
+
])
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
async def get_permissions_by_condition(self, condition: dict):
|
|
186
199
|
"""
|
|
187
|
-
Get permission(s) based on
|
|
188
|
-
|
|
200
|
+
Get permission(s) based on nested logical conditions.
|
|
201
|
+
|
|
202
|
+
Example:
|
|
203
|
+
{
|
|
204
|
+
"and": [
|
|
205
|
+
{"entity_id": "123"},
|
|
206
|
+
{"or": [
|
|
207
|
+
{"user_id": "456"},
|
|
208
|
+
{"group_id": "789"}
|
|
209
|
+
]}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
189
212
|
"""
|
|
190
213
|
with self.db() as session:
|
|
191
214
|
try:
|
|
192
|
-
query = session.query(Permission)
|
|
193
|
-
if use_filter_by:
|
|
194
|
-
query = query.filter_by(**condition)
|
|
195
|
-
else:
|
|
196
|
-
filters = [getattr(Permission, k) == v for k, v in condition.items()]
|
|
197
|
-
query = query.filter(*filters)
|
|
215
|
+
query = session.query(Permission).filter(self.build_filter(condition))
|
|
198
216
|
return query.all()
|
|
199
217
|
except Exception as e:
|
|
200
218
|
raise e
|
|
201
|
-
|
|
219
|
+
|
|
202
220
|
async def delete_permission_by_uuids(self,permission_uuids:List[str]):
|
|
203
221
|
"""
|
|
204
222
|
Delete a permission by uuids
|
|
@@ -153,6 +153,10 @@ class PermissionAction(str, Enum):
|
|
|
153
153
|
VIEW_IMPORT_DATA = "VIEW_IMPORT_DATA"
|
|
154
154
|
VIEW_WORKFLOW = "VIEW_WORKFLOW"
|
|
155
155
|
VIEW_ERROR_DATA = "VIEW_ERROR_DATA"
|
|
156
|
+
VIEW_ENTITY_RECORD = "VIEW_ENTITY_RECORD"
|
|
157
|
+
EDIT_ENTITY_RECORD = "EDIT_ENTITY_RECORD"
|
|
158
|
+
DELETE_ENTITY_RECORD = "DELETE_ENTITY_RECORD"
|
|
159
|
+
CREATE_ENTITY_RECORD = "CREATE_ENTITY_RECORD"
|
|
156
160
|
|
|
157
161
|
|
|
158
162
|
|
|
@@ -172,12 +176,17 @@ class PermissionModule(str, Enum):
|
|
|
172
176
|
ASL = "ASL"
|
|
173
177
|
EDS = "EDS"
|
|
174
178
|
WORKFORCE_AGENT = "WORKFORCE_AGENT"
|
|
175
|
-
|
|
179
|
+
ENTITY = "ENTITY"
|
|
180
|
+
ENTITY_VIEW = "ENTITY_VIEW"
|
|
181
|
+
ENTITY_RECORD = "ENTITY_RECORD"
|
|
182
|
+
CHATBOT = "CHATBOT"
|
|
176
183
|
|
|
177
184
|
|
|
178
185
|
class PermissionResource(str, Enum):
|
|
186
|
+
ENTITIES = "ENTITIES"
|
|
179
187
|
DASHBOARD = "DASHBOARDS"
|
|
180
188
|
WORKFORCE_AGENT = "WORKFORCE_AGENT"
|
|
189
|
+
CHATBOT = "CHATBOT"
|
|
181
190
|
EPAR = "EPAR"
|
|
182
191
|
EPARS = "EPARS"
|
|
183
192
|
OCFO = "OCFO"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/auth/auth_functions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/auth/jwt_functions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/auth/middleware.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/__init__.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/base_model.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/gov_casbin_rule.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/permissions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/rbac_model.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/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.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/models/user_permission.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/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.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/repository/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/schema/__init__.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/schema/permission.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/service/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.3.9 → abs_auth_rbac_core-0.3.11}/abs_auth_rbac_core/service/role_service.py
RENAMED
|
File without changes
|
|
File without changes
|