cancel
Showing results for 
Search instead for 
Did you mean: 

Error in navigating to the association in CAPM entity with @restrict annotation with custom attr

nileshpuranik
Explorer
0 Kudos

Dear all,

In a simple CAPM application, I have a 2 entities defined with parent and child relationship, salesOrder and salesOrderItems. The entities are from an external service oData V4. There is no persistence layer so no 'db' module in the application.

nileshpuranik_2-1710362372424.png

In the handler method of the entities, I am connecting to the external service and passing the query as it is.

nileshpuranik_3-1710362472423.png

In the xs-security.json file, I have defined certain role collections and roles with custom attribute customerId. I would like to grant access and show data for the customer based on the custom attribute assigned in the role, so that the user can only see the data based on the customerId assigned to him/her via the role.

nileshpuranik_0-1710362234190.png

On the header entity, I have used the restriction like this

@(restrict: [
{
grant: ['*'],
where: '$user.customerId = SoldToParty'
}

Without this restriction, everything works fine.

But when I add this restriction, the List report shows the data correctly ( filtered sales order as per the customerId in the role assigned to the user ) but the moment, I select a record and try to go to the object page in the fiori elements app, it gives me an error.

nileshpuranik_4-1710362719948.png

Basically it tries to carry the same filter of customerId while making call to the child entity which is not required.

nileshpuranik_5-1710362835066.png

Any advice how can i overcome this issue ? 

Many thanks in advance!

Br

Nilesh 

Accepted Solutions (0)

Answers (0)