Hiding delete button

Hello, I need to hide the remove workspace button from the web UI. button i need to hide So far I have written a filter extension to grant delete permission only to workspace types and administrators members:

<extension point="filters" target="org.nuxeo.ecm.platform.actions.ActionService">
    <filter id="canRemove">
        <rule grant="true">
            <permission>Remove</permission>
            <type>Workspace</type>
            <group>administrators</group>
        </rule>
    </filter>
</extension>

Also I found this guide https://www.nuxeo.com/blog/qa-friday-remove-tabs-buttons-links-specific-path/ which says I need to associate the filter to the action id in order to override it. So I coded another extension to associate it like this:

<extension target="org.nuxeo.ecm.platform.actions.ActionService" point="actions">
    <action id="TAB_TRASH_CONTENT">
            <filter-id>canRemove</filter-id>
    </action>
    <action id="CURRENT_SELECTION_TRASH">
            <filter-id>canRemove</filter-id>
    </action>
</extension>

However it is not working with any of this id's, and I can't find what the actual action id is, despite searching through the nuxeo explorer as the blog entry suggested I've yet to find it. How else can I find the action id for the delete button? Or is my extension wrong?

FILES:   remv_bttn.png
0 votes

1 answers

48 views

ANSWER



Hello,

This is because the UI display logic is in the delete button element : https://github.com/nuxeo/nuxeo-ui-elements/blob/08fd256fb4e7775375c176892098baec21fe302d/actions/nuxeo-delete-document-button.html#L115 i.e. it controls Write permissions. So implement your own UI contributions

Regards

0 votes



a c
Thank you for your answer. I modified the method with my custom logic and have been trying to make it work but found this error:

Uncaught DOMException: Failed to execute &apos;define&apos; on &apos;CustomElementRegistry&apos;: the name &quot;nuxeo-delete-document-button&quot; has already been used with this registry

Inside the class i changed this piece of code:

            customElements.define(SSADeleteDocumentButton.is, SSADeleteDocumentButton);
            Nuxeo.DeleteDocumentButton = SSADeleteDocumentButton;

But I'm not sure how to proceed of fix the error…

11/12/2019