syntax of Condition in Action filter

i would like to disable document creation according to a user attribute. The best way would be to overload the create and import action filters, but i'm not sure it's possible, so, I just overloaded the newDocument action with a custom filter that checks against a user attribute but it seems i'm missing the right syntax. I'm runnig a 5.4.2 server.

<action icon="/icons/action_add.gif" id="newDocument" label="action.new.document" link="javascript:Richfaces.showModalPanel('selectDocTypePanel');">
    <category>SUBVIEW_UPPER_LIST_HREF</category>
    <filter-id>create</filter-id>
    <filter-id>over_quota</filter-id>
    <filter id="over_quota"> 
    <rule grant="false">
        <condition>#{userSession.currentUser.quota>99}</condition>
    </rule>
    </filter>
</action>
0 votes

2 answers

2713 views

ANSWER

According to http://answers.nuxeo.com/questions/3596/ the ${currentUser.name='toto'} syntax works, but how can i access custom attributes ?
09/06/2012



Is this working?

<condition>${currentUser.model.user.quota>20}</condition>

currentUser is an instance of NuxeoPrincipal. You need to get to its corresponding document model to retrieve properties on it

0 votes



Unfortunately it seems not. I ve tried it using the "filters" and action "extension" point :

&lt;filter append=&quot;true&quot; id=&quot;create&quot;&gt;
  &lt;rule grant=&quot;false&quot;&gt;
    &lt;condition&gt;${currentUser.model.user.quota&gt;10}&lt;/condition&gt;
  &lt;/rule&gt;
&lt;/filter&gt;

&lt;action icon=&quot;/icons/action_add.gif&quot; id=&quot;newDocument&quot; label=&quot;action.new.document&quot; link=&quot;javascript:Richfaces.showModalPanel(&apos;selectDocTypePanel&apos;);&quot;&gt;
&lt;category&gt;SUBVIEW_UPPER_LIST_HREF&lt;/category&gt;
&lt;filter-id&gt;create&lt;/filter-id&gt;
&lt;filter-id&gt;over_quota&lt;/filter-id&gt;
&lt;filter id=&quot;over_quota&quot;&gt; 
&lt;rule grant=&quot;false&quot;&gt;

    &lt;condition&gt;${currentUser.model.user.quota&gt;10}&lt;/condition&gt;
&lt;/rule&gt;
&lt;/filter&gt;

</action>

10/18/2012


Use ${currentUser.schemaName.fieldName}

-1 votes



I like quick answers :)
09/12/2012

Did you arrive with my answer ?
09/13/2012

nope :

i ve overidden the user schema :

&lt;extension target=&quot;org.nuxeo.ecm.core.schema.TypeService&quot; point=&quot;schema&quot;&gt;
    &lt;schema name=&quot;user&quot; src=&quot;userShib.xsd&quot; override=&quot;true&quot; /&gt;
&lt;/extension&gt;

so, following your advice, i tried

&lt;condition&gt;${currentUser.user.quota&gt;20}&lt;/condition&gt;

that does not seem to work.

09/13/2012