IT Assets: add role-based auth system and portal user sync
Auth: - Fix local login (was redirecting to portal; now authenticates AdminUser directly) - Portal SSO still takes priority in production via nginx headers Role system (admin | editor | readonly): - New app/utils/decorators.py with editor_required and admin_required decorators - All write routes protected with editor_required (create/edit/delete/import/mask) - Settings user management protected with admin_required - Sidebar hides write-only links for readonly users - Dashboard quick actions and list page buttons hidden for readonly Settings page: - Role colour badges (admin=red, editor=blue, readonly=grey) - Inline role changer per user (dropdown auto-submit) - Reset password modal per user - Delete user button with confirmation - Add user form includes role selector with legend Portal user sync: - New /internal/sync-user endpoint receives user pre-creation from portal - INTERNAL_SYNC_SECRET added to config - portal/config.py: added internal_url for itassets app so _sync_user_to_app works
This commit is contained in:
@@ -38,6 +38,7 @@ def create_app(config_name='default'):
|
||||
from app.routes.audit import bp as audit_bp
|
||||
from app.routes.settings import bp as settings_bp
|
||||
from app.routes.doc_templates import bp as doc_templates_bp
|
||||
from app.routes.internal import bp as internal_bp
|
||||
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(dashboard_bp)
|
||||
@@ -48,6 +49,7 @@ def create_app(config_name='default'):
|
||||
app.register_blueprint(audit_bp)
|
||||
app.register_blueprint(settings_bp)
|
||||
app.register_blueprint(doc_templates_bp)
|
||||
app.register_blueprint(internal_bp)
|
||||
|
||||
# Inject common template variables
|
||||
from datetime import datetime, date
|
||||
|
||||
Reference in New Issue
Block a user