-
Notifications
You must be signed in to change notification settings - Fork 74
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
Added section to describe how parts of the UI can be hidden based on user role #940
base: main
Are you sure you want to change the base?
Conversation
maybe it should be mentioned, that there is a trade-off between having multiple apps for multiple roles or a single app for multiple roles. |
I agree but would argue that this should be part of Providing services or Modelling best practices. In general it is quite common that there is one app but create / edit / delete is restricted to an admin user, I'd say. |
annotate service.Books with @( | ||
UI.CreateHidden : { $edmJson: {$Not: { $Path: '/CatalogService.EntityContainer/Configuration/isAdmin'} } }, | ||
UI.UpdateHidden : { $edmJson: {$Not: { $Path: '/CatalogService.EntityContainer/Configuration/isAdmin'} } }, | ||
); |
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.
Hi @schiwekM ,
what is the result here? When I'm logged in as admin, I can't see the Books through this service?
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.
essentially if you are not the admin than you do not see the EDIT or Create buttons
```cds | ||
annotate service.Books with @( | ||
UI.CreateHidden : { $edmJson: {$Not: { $Path: '/Configuration/isAdmin'} } }, | ||
UI.UpdateHidden : { $edmJson: {$Not: { $Path: '/Configuration/isAdmin'} } }, | ||
); | ||
``` |
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.
This is doing the same as the previous snippet when using Fiori Elements, right? In which cases am I not allowed to do omit the entity container?
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.
Yes - EntityContainer is syntactically from an OData PoV correct however in most cases Fiori elements allows you to leave it out. For compatibility I added the entity container notation if something does not work that users can try the syntactically correct one.
Hi @renejeglinsky,
a few newcomers mentioned the lack of documentation on how parts of the UI can be hidden based on roles. This section should explain it.
@DanSchlachter Maybe it is also something to include in a tutorial or course / SFlight?
Hope the wording is understandable.
BR,
Marten