Jasper_07
Jasper_07

Reputation: 2473

Get a list of users current scopes

I have an XSA SAPUI5 app which is used in a workflow scenario by 2 roles

  1. data capturer
  2. data approver

scopes and roles for each defined in xs-security.json

I want to determine which scopes a user has, i can do that in an api by calling @sap/xxsec checkScope

eg

 app.get('/isApprover', (req, res)=>{
   const isAuthorized = req.authInfo.checkScope('$XSAPPNAME.Approver');
   if (!isAuthorized) {
      res.status(403).send('Forbidden');
   }
 })

is there a function similar in SQLScript?

You can access the Roles Attributes via

SELECT SESSION_CONTEXT('XS_COSTCENTER') FROM DUMMY

Also would be handy to get the ORG and SPACE from a SQL call

Upvotes: 1

Views: 341

Answers (0)

Related Questions