cancel
Showing results for 
Search instead for 
Did you mean: 

How to dynamically control Capabilities.InsertRestrictions

thejk
Explorer

Hello,

I have a Fiori Element List Report with local Annotations. The Annotations are created with the Annotation Modeler in WebIDE.

I want to control the possibility of creating new Entities in the EntitySet. For this I am using Capabilities.InsertRestrictions on EntitySet-Level:

Setting it to "true" or "false" works perfect, the "Create" Button is visible or not according to true/false.

But I want to control the visibility of the Button from the Backend depending on user authorizations.

Instead of using "Bool" for the Expression Type, I can use "Path" and name a Property of my Entity.

This works perfect for Capabilities.UpdateRestrictions as "Update" refers to a single Entity.

But it does'nt work for Capabilities.InsertRestrictions as "Insert" referes to the EntitySet. The Button is alway visible.

I know that there might be a solution using CDS/BOPF, but I don't want to do a complete redesign of the App.

Any help highly appreciated...

Thanks & Best Regards

Jürgen

Accepted Solutions (0)

Answers (1)

Answers (1)

Angshuman
Participant
0 Kudos

Hi Jürgen,

You can do this in MPC_EXT class by extending the Define method.

DATA(lo_eset) = model->get_entity_set( iv_entity_set_name = |***Entity Set Name****| ).
lo_eset->set_creatable( abap_true ).//Add Auth check

Thanks,

Angshuman

thejk
Explorer
0 Kudos

Hello Angshuman,

this was indeed the first thing I tried. Because of the caching in the Gateway this is not working. Not every call to the service calls the MPC_EXT - Class because Metadata is cached. You get the permissions of the user whose oData call filled the cache.

Regards,

Jürgen