on 12-22-2017 4:54 PM
Hi everybody,
we've implemented a solution in which a SAPUI5 application calls an oData service, exposed by a HANA system (XS Advanced), through SCP Mobile Services destination and Cloud Connector.
Now we're trying to filter data based on user logged in the application, without passing a parameter in URL calls, but using some sort of session variable inside our Calculation View exposed with .xsodata files.
We are able to retrieve the caller's username only inside .xsjs file.
Is there a way to use that information inside Calculation View?
Hi Edoardo,
Like you said, using parameters is not a good idea.
Instead, you need to rely on the DB itself to produce the correct output. Not only it is safer, but the result set will be better optimized.
XSA has DCL to produce DB Roles in HANA (CDS Roles) so your view will automatically filter out data based on user roles. DCL will rely on SESSION_CONTEXT, so you can retrieve attribute data dynamically on your CDS View and it will perform filters based on it. With DCL you could also define the data restriction based on static values, external attributes, etc. Please review this document.
XSC will rely on Analytical Privileges to restrict the outputted data. Check this examples for detailed information on how to create and use them for your Calculation Views. Check this blog for dynamic analytic privileges using procedures and how this privileges interact with Calculation Views on this blog. Another good blog points tho the step-by-steps required to create such privileges.
If you are still using Classic database objects on top of XSA I would highly recommend migrating such artifacts to CDS DDL.
Regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.