Skip to Content
0
Jan 09, 2023 at 02:37 PM

Apply dynamic restriction on a property of an Entity in CAP Project

568 Views

Hi,

I am working on CAP Project. Below are the CDS entity properties:

image.png

For the security of the application, I am using the XSUAA and I have two Roles: EmployeeAdmin and EmployeeViewer.

- EmployeeAdmin : Users having this Role will have 'READ' , 'WRITE' , 'UPDATE' permissions for entity properties 'Class' and 'Address' (i.e. will have Edit access for properties 'Class and 'Address').

- EmployeeViewer : Users having this Role will have 'READ' , 'WRITE' , 'UPDATE' permissions for only one entity property 'Address' ( i.e. will have edit access for property 'Address' only and won't have EDIT access for property 'Class').

Currently, I am able to apply restriction for Role 'EmployeeAdmin'. Below is the code from Service where properties 'Class' and 'Address' are editable.

image.png

image.png

But how to apply restriction based on Role 'EmployeeViewer' so as users will have Edit access for property 'Address' and property 'Class' will remain non-editable?

Thanks in advance!

Attachments

image.png (9.7 kB)
image.png (14.2 kB)
image.png (33.6 kB)
image.png (29.9 kB)