rb-commons 0.1.19__py3-none-any.whl → 0.1.20__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.
- rb_commons/configs/injections.py +1 -5
- rb_commons/permissions/role_permissions.py +5 -1
- {rb_commons-0.1.19.dist-info → rb_commons-0.1.20.dist-info}/METADATA +1 -1
- {rb_commons-0.1.19.dist-info → rb_commons-0.1.20.dist-info}/RECORD +6 -6
- {rb_commons-0.1.19.dist-info → rb_commons-0.1.20.dist-info}/WHEEL +0 -0
- {rb_commons-0.1.19.dist-info → rb_commons-0.1.20.dist-info}/top_level.txt +0 -0
rb_commons/configs/injections.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
from typing import Annotated
|
2
|
-
|
3
|
-
from rb_commons.permissions.role_permissions import IsAdmin, IsCustomer
|
4
2
|
from rb_commons.schemes.jwt import Claims
|
5
3
|
from fastapi import Request, Depends
|
6
4
|
|
@@ -8,6 +6,4 @@ from fastapi import Request, Depends
|
|
8
6
|
async def get_claims(request: Request) -> Claims:
|
9
7
|
return Claims.from_headers(dict(request.headers))
|
10
8
|
|
11
|
-
ClaimsDep = Annotated[Claims, Depends(get_claims)]
|
12
|
-
IsAdminDep = Annotated[IsAdmin, Depends(IsAdmin())]
|
13
|
-
IsCustomerDep = Annotated[IsCustomer, Depends(IsCustomer())]
|
9
|
+
ClaimsDep = Annotated[Claims, Depends(get_claims)]
|
@@ -1,5 +1,5 @@
|
|
1
|
+
from typing import Annotated
|
1
2
|
from fastapi import Depends
|
2
|
-
|
3
3
|
from rb_commons.configs.injections import get_claims
|
4
4
|
from rb_commons.http.exceptions import ForbiddenException
|
5
5
|
from rb_commons.schemes.jwt import Claims, UserRole
|
@@ -22,3 +22,7 @@ class IsAdmin(BasePermission):
|
|
22
22
|
class IsCustomer(BasePermission):
|
23
23
|
def has_permission(self, claims: Claims) -> bool:
|
24
24
|
return claims.user_role == UserRole.CUSTOMER
|
25
|
+
|
26
|
+
|
27
|
+
IsAdminDep = Annotated[IsAdmin, Depends(IsAdmin())]
|
28
|
+
IsCustomerDep = Annotated[IsCustomer, Depends(IsCustomer())]
|
@@ -1,17 +1,17 @@
|
|
1
1
|
rb_commons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
rb_commons/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
rb_commons/configs/config.py,sha256=tpqC1V9PXx88m0N5L13WqkoalPUk6SthjxgL_lmf-lE,1439
|
4
|
-
rb_commons/configs/injections.py,sha256=
|
4
|
+
rb_commons/configs/injections.py,sha256=6B1EOgIGnkWv3UrFaV9PRgG0-CJAbLu1UZ3kq-SjPVU,273
|
5
5
|
rb_commons/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
rb_commons/http/exceptions.py,sha256=EGRMr1cRgiJ9Q2tkfANbf0c6-zzXf1CD6J3cmCaT_FA,1885
|
7
7
|
rb_commons/orm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
rb_commons/orm/exceptions.py,sha256=1aMctiEwrPjyehoXVX1l6ML5ZOhmDkmBISzlTD5ey1Y,509
|
9
9
|
rb_commons/orm/managers.py,sha256=2RJyiW4uUYtgE_BzOS6Z3-TdHgXE0PPcFuQYt4Ze3MQ,7755
|
10
10
|
rb_commons/permissions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
rb_commons/permissions/role_permissions.py,sha256=
|
11
|
+
rb_commons/permissions/role_permissions.py,sha256=ihDoNjFjG9zrFz3Q3LgvHplQBBZdS7zrH-RyrxATj3Q,937
|
12
12
|
rb_commons/schemes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
rb_commons/schemes/jwt.py,sha256=F66JJDhholuOPPzlKeoC6f1TL4gXg4oRUrV5yheNpyo,1675
|
14
|
-
rb_commons-0.1.
|
15
|
-
rb_commons-0.1.
|
16
|
-
rb_commons-0.1.
|
17
|
-
rb_commons-0.1.
|
14
|
+
rb_commons-0.1.20.dist-info/METADATA,sha256=iXR8Kmu-U6WGrS8EDUCViPquatSaYXxq8QA3aENb1eQ,6533
|
15
|
+
rb_commons-0.1.20.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
16
|
+
rb_commons-0.1.20.dist-info/top_level.txt,sha256=HPx_WAYo3_fbg1WCeGHsz3wPGio1ucbnrlm2lmqlJog,11
|
17
|
+
rb_commons-0.1.20.dist-info/RECORD,,
|
File without changes
|
File without changes
|