How to set tags as view only for users of 'members' group?

Hello all,

Quick question. For the widget:

   <widget name="summary_current_document_tagging" type="summary_current_document_tagging">
        <labels>
            <label mode="any"/>
        </labels>
        <controls mode="any">
            <control name="requireSurroundingForm">true</control>
            <control name="handleLabels">true</control>
        </controls>
        <properties widgetMode="any">
            <property name="ajaxReRender">MultiTreeView</property>
            <property name="placeholder">
                #{messages['label.add.tag.placeholder']}
            </property>
        </properties>
    </widget>

I'm looking to do something like this:

{currentUser.isMemberOf('administrators') ? 'edit': 'view'}

This doesn't seem to work:

<widgetModes>
          <mode value="view">#{currentUser.isMemberOf('administrators') ? 'edit': 'view'}</mode>
</widgetModes>

For a temporary, not very attractive, solution:

Hacking the tagging_widget_template.xhtml -

<c:if test="#{currentUser.isMemberOf('administrators')}">
  <a4j:jsFunction name="addTagging"
    render="#{ajaxReRender}"
    action="#{tagSelect2Support.addTagging}">
   <a4j:param name="param1" assignTo="#{tagSelect2Support.label}" />
  </a4j:jsFunction>>
</c:if>

<c:if test="#{currentUser.isMemberOf('administrators')}">
  <a4j:jsFunction name="removeTagging"
     render="#{ajaxReRender}"
     action="#{tagSelect2Support.removeTagging}">
    <a4j:param name="param1" assignTo="#{tagSelect2Support.label}" />
  </a4j:jsFunction>
</c:if>

Any ideas how to accomplish this without hacking at the tagging_widget_template.xhtml ?

Thank you!

-Yousuf

0 votes

0 answers

1825 views

ANSWER