Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-21465

Fix which document is used for the evaluation of action filters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 5.8
    • Fix Version/s: None
    • Component/s: Actions & Filters

      Description

      The document associated to an action context, which is used to evaluate action filters, has changed between 5.6 and 5.8 (LTS versions where the change has been detected). This is mainly visible during document creation:

      • 5.6: the current document in the action context is the container (parent of the document which will be created)
      • 5.8: the current document in the action context is the document to create, with no reference to the repository

      This makes the permission evaluation fail now with the following stacktrace

      ERROR [nuxeo-error-log] javax.servlet.ServletException: /widgets/actions/document_actions_widget_template.xhtml @12,16 value="#{webActions.getDocumentActions(actionContextDocument, widgetProperty_category, not widgetProperty_disableFiltered, widgetProperty_postFilter)}" /widgets/actions/document_actions_widget_template.xhtml @12,16 value="#{webActions.getDocumentActions(actionContextDocument, widgetProperty_category, not widgetProperty_disableFiltered, widgetProperty_postFilter)}": java.lang.IllegalArgumentException: null docRref
      ...
      Caused by: javax.el.ELException: /widgets/actions/document_actions_widget_template.xhtml @12,16 value="#{webActions.getDocumentActions(actionContextDocument, widgetProperty_category, not widgetProperty_disableFiltered, widgetProperty_postFilter)}": java.lang.IllegalArgumentException: null docRref
      	at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)
      	at com.sun.faces.facelets.tag.TagAttributeImpl.getObject(TagAttributeImpl.java:356)
      	... 175 more
      Caused by: javax.el.ELException: java.lang.IllegalArgumentException: null docRref
      ...
      Caused by: java.lang.IllegalArgumentException: null docRref
      	at org.nuxeo.ecm.core.api.AbstractSession.resolveReference(AbstractSession.java:320)
      	at org.nuxeo.ecm.core.api.AbstractSession.hasPermission(AbstractSession.java:304)
      	at org.nuxeo.ecm.platform.actions.DefaultActionFilter.checkPermissions(DefaultActionFilter.java:242)
      	at org.nuxeo.ecm.platform.actions.DefaultActionFilter.checkRule(DefaultActionFilter.java:168)
      	at org.nuxeo.ecm.platform.actions.DefaultActionFilter.accept(DefaultActionFilter.java:110)
      	at org.nuxeo.ecm.platform.actions.ActionService.checkFilters(ActionService.java:301)
      	at org.nuxeo.ecm.platform.actions.ActionService.checkFilters(ActionService.java:140)
      	at org.nuxeo.ecm.platform.actions.ActionService.applyFilters(ActionService.java:121)
      	at org.nuxeo.ecm.platform.actions.ActionService.getActions(ActionService.java:169)
      	at org.nuxeo.ecm.webapp.action.WebActionsBean.getActions(WebActionsBean.java:129)
      	at org.nuxeo.ecm.webapp.action.WebActionsBean.getDocumentActions(WebActionsBean.java:101)
      

      This contribution helps to reproduce the bug in 5.8+ when trying to create a File document.

      <component name="org.nuxeo.ecm.platform.actions.more">
      
        <extension target="org.nuxeo.ecm.platform.actions.ActionService"
          point="actions">
          <action id="CreationDocument" label="Création" enabled="true" order="0" type="link" immediate="false" link="#{operationActionBean.doOperation('Bouton_Verification')}">
            <category>CREATE_DOCUMENT_FORM</category>
            <filter id="filter@CreationDocument">
              <rule grant="true">
                <permission>permAdministrateur</permission>
                <permission>permUtilisateur</permission>
                <permission>permGestionnaire</permission>
                <type>File</type>
              </rule>
              <rule grant="false">
                <condition>document.isImmutable() || document.isProxy()</condition>
              </rule>
            </filter>
          </action>
      
        </extension>
      
      </component>
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h