Usage of constraintOperationType in CUBA standard screens (like GroupBrowser)

Hi,

i played a little bit around with the constraintOperationType attribute of the actions in the table. When i tried to secure the Entity sec$Constraint itself (so that only the entries can be edited that have not a certain ‘createdBy’ attribute value), it turns out that the screens are not capable of handling this feature (see https://github.com/cuba-platform/cuba/blob/master/modules/gui/src/com/haulmont/cuba/gui/app/security/group/browse/group-browse.xml#L119).

I just wondered if this is by design that this is a opt-in feature instead of an opt-out feature. Because due to this it has to be configured for every browser screen in the app. But this will not work with the CUBA screens.

Or am i just missing something?

Thanks & Bye
Mario

Hi Mario,

You are right, it’s an opt-in feature and should be explicitly defined in a screen. In order to use it in a platform screen, you have to extend the screen in your project.

If you want to analyze appropriate constraints in standard actions by default, you can extend the actions in your project and override isPermitted() method. This is easily achievable since platform 6.4 - see JavaDocs on the action class, e.g. EditAction. If you do it, all screens including ones provided by the platform will use your implementation of the method.

Hi Konstantin,

thanks for the explanation and the hint with extending the different actions. Do i just have to redeclare the bean cuba_EditAction in my web-spring.xml and give a specialized class that extends EditAction, right?

Is there a reason other than backwards compatibility that it is not used for the standard actions by default? I mean when reading the docs it is not very clear that the described feature, although can be configured will not apply by default.

Bye
Mario

Do i just have to redeclare the bean cuba_EditAction in my web-spring.xml and give a specialized class that extends EditAction, right?

Exactly.

Is there a reason other than backwards compatibility that it is not used for the standard actions by default?

No, just an intention to introduce features carefully. Perhaps we should turn it on for standard actions by default in a future version, and make a switch to turn it off for existing projects just in case.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-8688