rb-commons 0.1.20__py3-none-any.whl → 0.1.22__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 rb-commons might be problematic. Click here for more details.
- rb_commons/configs/config.py +4 -0
- rb_commons/permissions/role_permissions.py +4 -2
- rb_commons/utils/__init__.py +0 -0
- rb_commons/utils/media.py +9 -0
- {rb_commons-0.1.20.dist-info → rb_commons-0.1.22.dist-info}/METADATA +1 -1
- {rb_commons-0.1.20.dist-info → rb_commons-0.1.22.dist-info}/RECORD +8 -6
- {rb_commons-0.1.20.dist-info → rb_commons-0.1.22.dist-info}/WHEEL +0 -0
- {rb_commons-0.1.20.dist-info → rb_commons-0.1.22.dist-info}/top_level.txt +0 -0
rb_commons/configs/config.py
CHANGED
|
@@ -20,6 +20,10 @@ class CommonConfigs(BaseSettings):
|
|
|
20
20
|
POSTGRES_DB: Optional[str] = None
|
|
21
21
|
DB_ALEMBIC_URL: Optional[str] = None
|
|
22
22
|
|
|
23
|
+
DIGITALOCEAN_STORAGE_BUCKET_NAME: Optional[str] = None
|
|
24
|
+
DIGITALOCEAN_S3_ENDPOINT_URL: Optional[str] = None
|
|
25
|
+
|
|
26
|
+
|
|
23
27
|
@property
|
|
24
28
|
def database_url(self) -> Optional[str]:
|
|
25
29
|
"""Construct the database URL if all required fields are present."""
|
|
@@ -10,6 +10,8 @@ class BasePermission:
|
|
|
10
10
|
if not self.has_permission(claims):
|
|
11
11
|
raise ForbiddenException(message=f"Access denied", status=401, code="0000")
|
|
12
12
|
|
|
13
|
+
return claims
|
|
14
|
+
|
|
13
15
|
def has_permission(self, claims: Claims) -> bool:
|
|
14
16
|
return False
|
|
15
17
|
|
|
@@ -24,5 +26,5 @@ class IsCustomer(BasePermission):
|
|
|
24
26
|
return claims.user_role == UserRole.CUSTOMER
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
IsAdminDep = Annotated[
|
|
28
|
-
IsCustomerDep = Annotated[
|
|
29
|
+
IsAdminDep = Annotated[Claims, Depends(IsAdmin())]
|
|
30
|
+
IsCustomerDep = Annotated[Claims, Depends(IsCustomer())]
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from rb_commons.configs.config import configs
|
|
2
|
+
|
|
3
|
+
class MediaUtils:
|
|
4
|
+
|
|
5
|
+
@staticmethod
|
|
6
|
+
def url_builder(key: str):
|
|
7
|
+
return "{endpoint_url}/{bucket_name}/{key}" \
|
|
8
|
+
.format(endpoint_url=configs.DIGITALOCEAN_S3_ENDPOINT_URL,
|
|
9
|
+
bucket_name=configs.DIGITALOCEAN_STORAGE_BUCKET_NAME, key=key)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
rb_commons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
rb_commons/configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
rb_commons/configs/config.py,sha256=
|
|
3
|
+
rb_commons/configs/config.py,sha256=dlsf1GDT81B_gOJkMHnnU5uHiCHiTIlvXNIdTu52E5k,1559
|
|
4
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
|
|
@@ -8,10 +8,12 @@ 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=3ZTwKclavAKSheO58fybo2uLDeTkd-iluTY7hUEjRPk,957
|
|
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
|
|
15
|
-
rb_commons
|
|
16
|
-
rb_commons-0.1.
|
|
17
|
-
rb_commons-0.1.
|
|
14
|
+
rb_commons/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
rb_commons/utils/media.py,sha256=KNY_9SdRa3Rp7d3B1tZaXkhmzVa65RcS62BYwZP1bVM,332
|
|
16
|
+
rb_commons-0.1.22.dist-info/METADATA,sha256=o7z8drcuIiQpTD8yPic5WTuskkxPZzRMpIzLAAyG7As,6533
|
|
17
|
+
rb_commons-0.1.22.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
18
|
+
rb_commons-0.1.22.dist-info/top_level.txt,sha256=HPx_WAYo3_fbg1WCeGHsz3wPGio1ucbnrlm2lmqlJog,11
|
|
19
|
+
rb_commons-0.1.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|