cancel
Showing results for 
Search instead for 
Did you mean: 

CAP: Data Masking

alicegavanelli
Participant
0 Kudos
703

Hi Experts,

In order to hidden an entity’s property, I have created an artifact HANA table with data MASK.

I exposed this entity in my CDS model with @cds.persistence.exists

Everythins woks but when I do GET call by oData, this field is not hidden.

Checking in SQL console on the HDI container, the selected field is correcty hiden.

Maybe MASK functionality is not managed by CAP.

Is It planned to implemented it in the fucture?

I have try this workaround cause event .ON and .AFTER doesn’t works.

Thank you in advance

Alice

View Entire Topic
vLeonkev
Product and Topic Expert
Product and Topic Expert

Hi Alice,

I tried it from scratch and it worked without any additional user permissions.

Here the model I used:

db/src/.hdiconfig - same as gen/db/src/.hdiconfig (generated after the first cds build command)

db/src/SERV_T.hdbtable

COLUMN TABLE SERV_T (
  ID integer,
  S nvarchar(100),
  primary key ( ID )
)

db/src/SERV_V.hdbview

VIEW SERV_V AS SELECT ID,S FROM SERV_T
WITH MASK (S USING 'XXXX-XXXX-XXXX-XXXX')

srv/serv.cds

service SERV {

@cds.persistence.exists
entity T {
  key ID:Integer;
  S:String(100);
};

@cds.persistence.exists
entity V {
  key ID:Integer;
  S:String(100);
};

Build and deploy the project, write some data into the table T, and read from view V the masked data via the OData service:

.... "S": "XXXX-XXXX-XXXX-XXXX" ....

Reading from T returns the original data that I wrote.

Regards,

Vladislav