cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the users assigned to a role in SAP BTP using SAP CAP?

Bastian
Explorer
0 Kudos

Target is get a list of all SAP BTP users which are assigned to a specific role. Each SAP BTP user should be identified through its SAP BTP user ID.

The role is defined in my app, so I know the role 🙂

My app is created in SAP BAS (Business Application Studio) and I'm using the SAP CAP (Cloud Application Programing Model) to create/code it. So the question is how to reach this in SAP CAP?

Accepted Solutions (1)

Accepted Solutions (1)

CarlosRoggan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Bastian,

if I understand the question, you can use a REST API to access roles etc.
You need access to APIs via credentials of xsuaa instance.
Then you can navigate through the REST APIs.
There are several possibilities, please check the reference that can be found in below link.
The following tutorial should get you started:

https://blogs.sap.com/2022/10/12/sap-btp-security-how-to-use-rest-api-of-xsuaa-to-programmatically-m...

Kind Regards,

Carlos

Bastian
Explorer

Hi Carlos,

Thanks, your block was helpful - there I found the hint to the required API:

Get users (Platform API😞
https://api.authentication.us10.hana.ondemand.com/Users

Best regards, Bastian

CarlosRoggan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks for the feedback, b019790315 , good to know that it has unblocked you and also thanks for sharing the link, that's useful for all readers as well

Kind Regards,

Carlos

Answers (1)

Answers (1)

todor_petrov
Contributor
0 Kudos

Hi Bastian,

I hope I understood your question right and if I did, you can take advantage of the Role/Role Collection concept in SAP BTP CF. Each role you create in your app can be assigned to a Role Collection, which later can easily be assigned (manually or through mapping) to users available in the subaccount.

If your CF is connected to IAS, then you can also define a mapping and the assignment will happen automatically on the fly, even for new users.

BR,

Todor