Skip to content

Show info about missing permission on AccessForbiddenException#416

Open
rogersteblerbsi wants to merge 1 commit into
releases/26.2from
features/rsb/26.2/326455_errorCode
Open

Show info about missing permission on AccessForbiddenException#416
rogersteblerbsi wants to merge 1 commit into
releases/26.2from
features/rsb/26.2/326455_errorCode

Conversation

@rogersteblerbsi

Copy link
Copy Markdown
Member

On a permission check an AccessForbiddenException is thrown. A message is shown to the user with a message like "You are not authorized to execute this action". But the user does not know which permission is missing.

This change adds an error code to the error popup on an AccessForbiddenException to give the user a hint which permission is missing.

326455

@rogersteblerbsi rogersteblerbsi self-assigned this Jun 29, 2026
throw new AccessForbiddenException(TEXTS.get("YouAreNotAllowedToReadThisData"));
if (!ACCESS.check(new ReadCompanyPermission())) { // <1>
throw new AccessForbiddenException(TEXTS.get("YouAreNotAllowedToReadThisData"))
.withPermission(ReadCompanyPermission.class);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also change documentation here:

[source,java,indent=0]
----
include::common:example$org.eclipse.scout.docs.snippets/src/main/java/org/eclipse/scout/docs/snippets/AccessSnippet.java[tags=ACCESS_A]
----
<1> Checks permission against granted permissions of current user.
<2> Checks permission and if this check fails, throw an `AccessForbiddenException` with a default message.
We can define a default access check failed message for a permission.

And add migration notes for users?

On a permission check an AccessForbiddenException is thrown. A message
is shown to the user with a message like "You are not authorized to
execute this action". But the user does not know which permission is
missing.

This change adds an error code to the error popup on an
AccessForbiddenException to give the user a hint which permission
is missing.

326455
@rogersteblerbsi rogersteblerbsi force-pushed the features/rsb/26.2/326455_errorCode branch from cfdc72a to ee34f98 Compare June 30, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants