Imporve the role based forntend protected roles
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user