abs-auth-rbac-core 0.1.3__tar.gz → 0.1.5__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.
Files changed (24) hide show
  1. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/PKG-INFO +1 -1
  2. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/auth/middleware.py +1 -1
  3. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/rbac/decorator.py +7 -6
  4. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/pyproject.toml +1 -1
  5. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/README.md +0 -0
  6. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/__init__.py +0 -0
  7. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/auth/__init__.py +0 -0
  8. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/auth/auth_functions.py +0 -0
  9. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/auth/jwt_functions.py +0 -0
  10. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/__init__.py +0 -0
  11. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/base_model.py +0 -0
  12. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/gov_casbin_rule.py +0 -0
  13. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/permissions.py +0 -0
  14. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/rbac_model.py +0 -0
  15. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/role_permission.py +0 -0
  16. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/roles.py +0 -0
  17. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/seeder/permission_seeder.py +0 -0
  18. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/user.py +0 -0
  19. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/models/user_role.py +0 -0
  20. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/rbac/__init__.py +0 -0
  21. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/rbac/policy.conf +0 -0
  22. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/rbac/service.py +0 -0
  23. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/util/__init__.py +0 -0
  24. {abs_auth_rbac_core-0.1.3 → abs_auth_rbac_core-0.1.5}/abs_auth_rbac_core/util/permission_constants.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: abs-auth-rbac-core
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: RBAC and Auth core utilities including JWT token management.
5
5
  License: MIT
6
6
  Author: AutoBridgeSystems
@@ -43,7 +43,7 @@ def auth_middleware(
43
43
 
44
44
  # Attach user to request state
45
45
  request.state.user = user
46
- return user # Still return user for backward compatibility
46
+ return user
47
47
 
48
48
  except Exception as e:
49
49
  logger.error(f"Authentication error: {str(e)}", exc_info=True)
@@ -1,6 +1,6 @@
1
1
  from functools import wraps
2
2
  from typing import Dict, List, Union
3
-
3
+ from fastapi import Request
4
4
  from abs_exception_core.exceptions import PermissionDeniedError
5
5
  from .service import RBACService
6
6
 
@@ -20,10 +20,11 @@ def rbac_require_permission(permissions: Union[str, List[str]]):
20
20
  def decorator(func):
21
21
  @wraps(func)
22
22
  async def wrapper(
23
- *args, current_user: Dict,rbac_service:RBACService, **kwargs,
23
+ request:Request,
24
+ *args,rbac_service:RBACService, **kwargs,
24
25
  ):
25
- current_user_id = current_user.get("uuid")
26
- if not current_user_id:
26
+ current_user_uuid = request.state.user.uuid
27
+ if not current_user_uuid:
27
28
  raise PermissionDeniedError(
28
29
  detail="User not found (missing 'uuid')."
29
30
  )
@@ -36,13 +37,13 @@ def rbac_require_permission(permissions: Union[str, List[str]]):
36
37
  )
37
38
 
38
39
  has_permission = rbac_service.check_permission(
39
- user_uuid=current_user_id, resource=resource, action=action,module=module
40
+ user_uuid=current_user_uuid, resource=resource, action=action,module=module
40
41
  )
41
42
 
42
43
  if not has_permission:
43
44
  raise PermissionDeniedError(
44
45
  detail=f"Permission denied: {action} on {resource} in {module}"
45
46
  )
46
- return await func(*args, current_user=current_user,rbac_service=rbac_service, **kwargs)
47
+ return await func(*args,request=request,rbac_service=rbac_service, **kwargs)
47
48
  return wrapper
48
49
  return decorator
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "abs-auth-rbac-core"
3
- version = "0.1.3"
3
+ version = "0.1.5"
4
4
  description = "RBAC and Auth core utilities including JWT token management."
5
5
  authors = [
6
6
  {name = "AutoBridgeSystems", email = "info@autobridgesystems.com"}