Spaces:
Sleeping
Sleeping
Commit ·
3806039
1
Parent(s): 794dd69
feat: Enhance logging for role permission retrieval and correct role identifier in seed script
Browse files
app/dependencies/pos_permissions.py
CHANGED
|
@@ -33,6 +33,7 @@ class POSPermissionChecker:
|
|
| 33 |
Example: {"sales": ["view", "create", "update"], "customers": ["view", "create"]}
|
| 34 |
"""
|
| 35 |
try:
|
|
|
|
| 36 |
role_doc = await self.roles_collection.find_one(
|
| 37 |
{"role_id": role_id, "is_active": True}
|
| 38 |
)
|
|
@@ -42,7 +43,7 @@ class POSPermissionChecker:
|
|
| 42 |
return None
|
| 43 |
|
| 44 |
permissions = role_doc.get("permissions", {})
|
| 45 |
-
logger.
|
| 46 |
return permissions
|
| 47 |
|
| 48 |
except Exception as e:
|
|
|
|
| 33 |
Example: {"sales": ["view", "create", "update"], "customers": ["view", "create"]}
|
| 34 |
"""
|
| 35 |
try:
|
| 36 |
+
logger.info(f"Looking up permissions for role: {role_id}")
|
| 37 |
role_doc = await self.roles_collection.find_one(
|
| 38 |
{"role_id": role_id, "is_active": True}
|
| 39 |
)
|
|
|
|
| 43 |
return None
|
| 44 |
|
| 45 |
permissions = role_doc.get("permissions", {})
|
| 46 |
+
logger.info(f"Retrieved permissions for role {role_id}: {permissions}")
|
| 47 |
return permissions
|
| 48 |
|
| 49 |
except Exception as e:
|
scripts/seed_permissions.py
CHANGED
|
@@ -22,8 +22,8 @@ from app.core.config import settings
|
|
| 22 |
|
| 23 |
# POS Role Permissions
|
| 24 |
POS_ROLES = {
|
| 25 |
-
"
|
| 26 |
-
"role_id": "
|
| 27 |
"role_name": "Salon Owner",
|
| 28 |
"description": "Salon/Spa owner with full access to POS operations",
|
| 29 |
"permissions": {
|
|
|
|
| 22 |
|
| 23 |
# POS Role Permissions
|
| 24 |
POS_ROLES = {
|
| 25 |
+
"role_salon_owner": {
|
| 26 |
+
"role_id": "role_salon_owner",
|
| 27 |
"role_name": "Salon Owner",
|
| 28 |
"description": "Salon/Spa owner with full access to POS operations",
|
| 29 |
"permissions": {
|