05/06 Modify Director's can NOT change user role, Inspector can view own reports 2
This commit is contained in:
+6
-1
@@ -56,7 +56,12 @@ class UserForm(FlaskForm):
|
||||
('inspector', 'Inspector'),
|
||||
('project_manager', 'Project Manager'),
|
||||
# 'customer' is intentionally excluded — customer accounts are managed via /customers
|
||||
], validators=[DataRequired()])
|
||||
], validators=[Optional()])
|
||||
# NOTE: Optional() here because directors submit no role value (the field is
|
||||
# hidden in user_form.html for them). Role enforcement is handled in the
|
||||
# route: directors always keep/default to 'inspector'; only admins may set
|
||||
# an arbitrary role. DataRequired() would cause validate_on_submit() to
|
||||
# fail silently for directors, preventing any save at all.
|
||||
|
||||
def __init__(self, user=None, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user