-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
Affix webserver access_denied warning to be configurable #33022
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,10 @@ | |
T = TypeVar("T", bound=Callable) | ||
|
||
|
||
def get_access_denied_message(): | ||
return conf.get("webserver", "access_denied_message") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should either use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really. The The way it works when it is put in config.yml is that "default" is automatically used as fallback if there is no fallback (It's been working like that already for quite some time via defaul_config.cfg - so my recent change has not changed it - jut made it works without the default_config.cfg There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it is needed as @potiuk mentions here. The older default text is passed as the default in the new property in config.yml, which is basically the fallback. |
||
|
||
|
||
def has_access(permissions: Sequence[tuple[str, str]] | None = None) -> Callable[[T], T]: | ||
"""Factory for decorator that checks current user's permissions against required permissions.""" | ||
|
||
|
@@ -59,7 +63,7 @@ def decorated(*args, **kwargs): | |
403, | ||
) | ||
else: | ||
access_denied = "Access is Denied" | ||
access_denied = get_access_denied_message() | ||
flash(access_denied, "danger") | ||
return redirect(get_auth_manager().get_url_login(next=request.url)) | ||
|
||
|
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.
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.
I dont think we can do that. The current message is "Access is Denied" so in order to keep the current experience, we got to have this default value
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.
Agreed. We do not want to break the backward compatibility experience. If we want to make this change, we should have a different task for it instead
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.
I agree with @vincbeck