melai
melai

Reputation: 97

Get authenticated user ID inside SAPUI5 app

We are creating a custom dynamic sap Fiori/SAPUI5 application tile in our launchpad. It seems like you just need to put the odata service call with a $count for the dynamic tile to show list of pending items. For example

/MyListSet/$count

will output 100 pending items

But what if we want to check if the user has authorization to items in the list? I'm considering putting something like

/MyListSet('USER')/$count

but this doesn't seem to be possible as the USER is unknown until runtime.

Is there a way to get the logged user calling the OData service and pass this user to our OData call via RFC and filter the result from there?

Upvotes: 0

Views: 1603

Answers (1)

batleth
batleth

Reputation: 36

The user should already be authenticated with the system if he sees your app/launchpad. I would suggest that you use the sy-uname system variable and filter your entityset before responding to frontend. This should not be implemented in SAPUI5 instead use the ABAP Gateway service.

Upvotes: 2

Related Questions