-
Notifications
You must be signed in to change notification settings - Fork 92
Admin‑Configurable Access Denied Message #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Development
Are you sure you want to change the base?
Conversation
…sted to Cosmos DB. Default to hard-coded message.
…sted to Cosmos DB. Default to hard-coded message.
498342c to
a7b07f0
Compare
|
@vivche Please update the default message from "Please submit a ticket to request access." to "Please contact an administrator for access." Not all teams may use a ticketing system. |
@Bionic711 Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces an admin-configurable access denied message feature that allows tenant administrators to customize the message shown to authenticated users who lack the required roles to access the application. The implementation includes a hardcoded default message in functions_settings.py, an admin UI field in the Settings page to override this message, proper persistence to Cosmos DB, and rendering on the home page with support for line breaks.
Changes:
- Added
access_denied_messagesetting with a default value and admin override capability - Implemented form field in Admin Settings for message configuration
- Updated home page template to display the customizable message with HTML escaping and newline-to-
<br>conversion
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| application/single_app/functions_settings.py | Added default access_denied_message setting with hardcoded fallback value |
| application/single_app/route_frontend_admin_settings.py | Added form data processing to persist access_denied_message from Admin Settings |
| application/single_app/templates/admin_settings.html | Added textarea field for editing the access denied message |
| application/single_app/templates/index.html | Updated to render customizable access denied message with HTML escaping and line break support |
| 'default_system_prompt': '', | ||
| # Access denied message shown on the home page when a signed-in user lacks required roles | ||
| # Default is hard-coded; admins can override via Admin Settings (persisted in Cosmos DB) | ||
| 'access_denied_message': 'You are logged in but do not have the required permissions to access this application.\nPlease contact an administrator for access.', |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default message here differs from the fallback in index.html template (line 65). The index.html fallback says "Please submit a ticket to request access" while this default says "Please contact an administrator for access." This inconsistency means users will see different messages depending on whether settings exist in Cosmos DB. Either both should match, or the fallback in the template should be removed entirely to always use this default.
| 'access_denied_message': 'You are logged in but do not have the required permissions to access this application.\nPlease contact an administrator for access.', | |
| 'access_denied_message': 'You are logged in but do not have the required permissions to access this application.\nPlease submit a ticket to request access.', |
| <p class="lead"> | ||
| You are logged in but do not have the required permissions to access this application. | ||
| Please submit a ticket to request access. | ||
| {{ (app_settings.access_denied_message or 'You are logged in but do not have the required permissions to access this application. Please submit a ticket to request access.') | e | replace('\n','<br>') | safe }} |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filter chain here has a potential issue with the order of operations. The current chain is: '| e | replace('\n','
') | safe'. This means HTML entities are escaped first (including any literal '
' in the text), then newlines are replaced with '
', then marked as safe. However, since the replacement happens after escaping, any literal '
' typed by the admin will be double-escaped and display as text rather than rendering as a line break. Consider using the 'nl2br' filter if available, or ensure the replacement happens before escaping.
| {{ (app_settings.access_denied_message or 'You are logged in but do not have the required permissions to access this application. Please submit a ticket to request access.') | e | replace('\n','<br>') | safe }} | |
| {{ (app_settings.access_denied_message or 'You are logged in but do not have the required permissions to access this application. Please submit a ticket to request access.') | e | nl2br }} |
Overview
Adds a user‑facing message shown on the home page when a signed‑in user lacks required roles. Admins can set and update this message in Admin Settings; the value is persisted in Azure Cosmos DB. A stable, hard‑coded default remains in place when no admin override is set.
Purpose
Technical Specification
default_settings['access_denied_message'].access_denied_messageand persists it viaupdate_settings()to Cosmos.app_settingsand renders the message with HTML escaping and newline‑to‑<br>conversion.Files Touched
access_denied_messageprocessing and persistence in Admin Settings POST handling.access_denied_messagetextarea field to the Admin Settings UI.Usage
Limitations
<br>in the Admin textarea may display as text rather than a line break.Testing & Validation
<br>in the stored message can still display as text in some input paths.