Search code examples
sapui5

Using SAPUI5 Portal roles in Java backend


I am creating a planning application in SAPUI5 and deploying it to a portal site. I'm using two roles (PlanningUserRole & PlanningAdminRole). Can I somehow retrieve the role of the user in the SAPUI5 application so I can pass it on to the Java backend?

I've tried the code below, but it doesn't give me any information regarding the roles.

sap.ushell.Container.getService("UserInfo").getUser();

Solution

  • I found a solution myself. I added SCP Portal roles and the Java application roles to an Authorization Group (Security --> Authorization --> Groups). I named them both the same. The only difference is the origin. But it works just fine.