Changing Condition for Cut settings

In my plone 5.2 System, there are some problems by using the commands cut, delete and move.
The inherited settings in the access rights for a user are not correct and some modified access rights are needed.

To fix the problem manually for e.g. cut it is possible to adjust the settings in the menu

/portal_actions/object_buttons/cut/manage_workspace

for the Condition.

After saving the changes the Cut function will be working correct.

If i try the change by programming in the setuphandler, the change will be set in the field Contidtion, but it will not be activated.

Plone it still using the default Condition

condition = 'python:checkPermission("Delete objects",object) '+ \
'and checkPermission("Copy or Move",object) ' + \
'and not globals_view.isPortalOrPortalDefaultPage()'

portal['portal_actions']['object_buttons']['cut'].available_expr = condition
portal['portal_actions']['object_buttons']['cut']._p_changed=True

The question is, which code will be called by the Button „Save changes“ to activate a custom Cut Contition by programming?

Thomas via Plone Community wrote at 2025-1-8 04:34 +0000:

...
If i try the change by programming in the setuphandler, the change will be set in the field Contidtion, but it will not be activated.

Plone it still using the default Condition

condition = 'python:checkPermission("Delete objects",object) '+ \
'and checkPermission("Copy or Move",object) ' + \
'and not globals_view.isPortalOrPortalDefaultPage()'

portal['portal_actions']['object_buttons']['cut'].available_expr = condition

I assume that the main problem is that your condition is a string
while the code expects an Expression object.

Look at Products.CMFCore.ActionInformation.ActionInformation.edit
to learn how to correctly convert a string representation to
an Expression object.

I suspect you may want to just use profiles/default/actions.xml to put any action overrides in, instead of trying to do this imperatively in Python setuphandlers.