Enabling role-based security
Role-based security allows securing the entire flow, page, or certain components on a page, for example, hiding a button
component from a page for a certain user role or restricting access for the entire page for a certain user role. Role-based security makes the application secure and prevents access to the application flow, page, or components from unauthorized users.
In order to secure UI components on a page, use the following expression:
<oj-bind-if test="[[ $application.user.roles.user_role_name]]" > </oj-bind-if>
In the preceding code, replace user_role_name
with the user role name that is created in the User Roles tab, as follows:
<oj-bind-if test="[[ $application.user.roles.AdminRole ]]" > </oj-bind-if>
We'll use the oraclecloudext_chapter9
web application to apply the security. Here are the steps to show the Update Customer button only if the logged-in user role falls under AdminRole...