How can I prevent a user action to be shown if the user has Write right?

I have defined a user action that only needs to be shown if the current user doesn't have Write permission on the current document. My guess is I should use the “Custom EL expression” field in Studio but I could use some guidance on what to write there.

Basically I want it to say " Show the user action this only if the user doesn't have Write permission”

0 votes

2 answers

1810 views

ANSWER



Hi,

I found a ugly way to do that, waiting of a better solution:

${documentManager.hasPermission(currentDocument.getRef(), "Write") == false}
1 votes



hello,

the right way is to define a rule that deny access (grant=false) after checking the permission Write. For instance:

<action id="M_USER_ACTION" link="#{foo.bar}" order="100"
  label="foobar" icon="/icons/foobar.png">
  <category>VIEW_ACTION_LIST</category>
  <filter id="foobar-filter">
    <rule grant="false">
      <permission>Write</permission>
    </rule>
  </filter>
</action>
-1 votes



this solution is not compliant with using Nuxeo Studio, the previous one will work better
11/09/2011