Imporve the role based forntend protected roles

This commit is contained in:
Urtzi Alfaro
2025-09-09 07:32:59 +02:00
parent ddb75f8e55
commit 5269a083b6
15 changed files with 286 additions and 91 deletions

View File

@@ -55,7 +55,9 @@ class EnhancedAuthService:
raise ValueError("Password does not meet security requirements")
# Create user data
user_role = user_data.role if user_data.role else "user"
# Default to admin role for first-time registrations during onboarding flow
# Users creating their own bakery should have admin privileges
user_role = user_data.role if user_data.role else "admin"
hashed_password = SecurityManager.hash_password(user_data.password)
create_data = {

View File

@@ -413,7 +413,7 @@ class EnhancedUserService:
user_repo = UserRepository(User, session)
# Validate role
valid_roles = ["user", "admin", "super_admin"]
valid_roles = ["user", "admin", "manager", "super_admin"]
if new_role not in valid_roles:
raise ValidationError(f"Invalid role. Must be one of: {valid_roles}")