cancel
Showing results for 
Search instead for 
Did you mean: 

Evaluator for group membership

marcello_modica
Champ in-the-making
Champ in-the-making
Why this evaluator dowsn't work:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <!– Has "isoDocument:isoDocumentPublished" evaluator –>
   <bean id="com.pasello.iso.isoDocumentAspect" parent="evaluator.doclib.action.hasAspect">
      <property name="aspects">
         <list>
            <value>isoDocument:isoDocumentPublished</value>
         </list>
      </property>
   </bean>
<bean id="com.pasello.iso.isoDocumentManagers" parent="evaluator.doclib.action.groupMembership">
   <property name="relation" value="OR"/>
      <property name="groups">
         <list>
            <value>isoDocumentManagers</value>
         </list>
      </property>
   </bean>
</beans>



I need it in doclib action evaluation

<alfresco-config>

 
   <config evaluator="string-compare" condition="DocLibActions">

      <!–
         Action definitions
      –>
      <actions>
         <!– Transfor Document To PDF –>
         <action id="publish-to-ISO" type="javascript" label="Pubblica su documentazione ISO">
            <param name="function">onActionSimpleRepoAction</param>
            <!– Additional parameters for onRepoAction function  –>
            <param name="action">publish-to-ISO</param>
            <param name="successMessage">Pubblicata corrattamente sulla documentazione ISO</param>
            <param name="failureMessage">Errore di pubblicazione contattare l'amministratore del sistema</param>
            <evaluator negate="true">com.pasello.iso.isoDocumentAspect</evaluator>
            <evaluator>com.pasello.iso.isoDocumentManagers</evaluator>
         </action>
      </actions>
      <actionGroups>
          <actionGroup id="document-browse">
             <action index="460" id="publish-to-ISO"/>
          </actionGroup>
          <actionGroup id="document-details">
            <action index="400" id="publish-to-ISO"/>
          </actionGroup>
      </actionGroups>
     </config>

</alfresco-config>
7 REPLIES 7

marcello_modica
Champ in-the-making
Champ in-the-making
I make mistake with double evaluator. Sorry, but the evaluator evaluator.doclib.action.groupMembership, doesn't work. this is the correct code

<alfresco-config>

 
   <config evaluator="string-compare" condition="DocLibActions">

      <!–
         Action definitions
      –>
      <actions>
         <!– Transfor Document To PDF –>
         <action id="publish-to-ISO" type="javascript" label="Pubblica su documentazione ISO">
            <param name="function">onActionSimpleRepoAction</param>
            <!– Additional parameters for onRepoAction function  –>
            <param name="action">publish-to-ISO</param>
            <param name="successMessage">Pubblicata corrattamente sulla documentazione ISO</param>
            <param name="failureMessage">Errore di pubblicazione contattare l'amministratore del sistema</param>
            <evaluator>com.pasello.iso.isoDocument</evaluator>
            
         </action>
      </actions>
      <actionGroups>
          <actionGroup id="document-browse">
             <action index="460" id="publish-to-ISO"/>
          </actionGroup>
          <actionGroup id="document-details">
            <action index="400" id="publish-to-ISO"/>
          </actionGroup>
      </actionGroups>
     </config>

</alfresco-config>
  



<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <!– Has "isoDocument:isoDocumentPublished" evaluator –>
   <bean id="com.pasello.iso.isoDocumentAspect" parent="evaluator.doclib.action.hasAspect">
      <property name="aspects">
         <list>
            <value>isoDocument:isoDocumentPublished</value>
         </list>
      </property>
   <property name="negateOutput" value="true" />
   </bean>
<bean id="com.pasello.iso.isoDocumentManagers" parent="evaluator.doclib.action.groupMembership">
   <property name="relation" value="OR"/>
      <property name="groups">
         <list>
            <value>isoDocumentManagers</value>
         </list>
      </property>
   </bean>

   <bean id="com.pasello.iso.isoDocument" parent="evaluator.doclib.action.chainedMatchOne">
      <property name="evaluators">
         <list>
            <ref bean="com.pasello.iso.isoDocumentManagers" />
            <ref bean="com.pasello.iso.isoDocumentAspect" />
         </list>
      </property>
   </bean>
</beans>

muralidharand
Star Contributor
Star Contributor
Hi,
When you say, it does not working, means, does the bean is getting when you debug the evaluator code?

Please let me know, where you have defined the "evaluator.doclib.action.groupMembership" bean?

It is definied as default in 4.2f. It is defined in: slingshot-documentlibrary-context.xml

marcello_modica
Champ in-the-making
Champ in-the-making

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <!– Has "isoDocument:isoDocumentPublished" evaluator
   <bean id="com.pasello.iso.isoDocumentAspect" parent="evaluator.doclib.action.hasAspect">
      <property name="aspects">
         <list>
            <value>isoDocument:isoDocumentPublished</value>
         </list>
      </property>
   </bean>–>
   <bean id="evaluator.doclib.action.groupMembership" class="org.alfresco.web.evaluator.HasGroupMembershipsEvaluator">
      <property name="slingshotEvaluatorUtil" ref="slingshot.evaluator.utility" />
   </bean>
  
    <bean id="com.pasello.iso.isoDocument" parent="evaluator.doclib.action.groupMembership">
   <property name="groups">
         <list>
            <value>GROUP_isoDocumentManagers</value>
         </list>
      </property>
   </bean>
<!–

<bean id="com.pasello.iso.isoDocumentManagers" parent="evaluator.doclib.action.groupMembership">
   <property name="groups">
         <list>
            <value>GROUP_isoDocumentManagers</value>
         </list>
      </property>
   </bean>

   <bean id="com.pasello.iso.isoDocument" parent="evaluator.doclib.action.chainedMatchAll">
      <property name="evaluators">
         <list>
            <ref bean="com.pasello.iso.isoDocumentManagers" />
            <ref bean="com.pasello.iso.isoDocumentAspect" />
         </list>
      </property>
   </bean>
   –>
</beans>

jpotts
World-Class Innovator
World-Class Innovator
I set up a simple test for the GroupMembership evaluator.

Here is my share-config-custom.xml related to the evaluator:

    <config evaluator="string-compare" condition="DocLibActions">
        <actions>
            <action id="someco-web-site" type="link" label="actions.someco.web-site" icon="someco-website">
                <param name="href">http://ecmarchitect.com</param>
                <param name="target">_blank</param>
                <evaluator>someco.evaluator.doclib.action.isPublisher</evaluator>
            </action>
            <action id="metaversant-web-site" type="link" label="actions.someco.web-site" icon="someco-website">
                <param name="href">http://www.metaversant.com</param>
                <param name="target">_blank</param>
                <evaluator negate="true">someco.evaluator.doclib.action.isPublisher</evaluator>
            </action>


And here is the snippet from my context XML:

   <bean id="someco.evaluator.doclib.action.isPublisher" parent="evaluator.doclib.action.groupMembership">
      <property name="groups">
         <list>
            <value>GROUP_publisher</value>
         </list>
      </property>  
   </bean>


When I log in as a member of the Publisher group, I see the link to ecmarchitect but I do not see the link to metaversant, which is working as I expect.

When I log in as someone who is not a member of the Publisher group, I do not see either action, which is not what I expect based on that negate. But you aren't using negate so that isn't relevant to you.

Jeff

nathanm
Champ in-the-making
Champ in-the-making
dear jeff,
I have similar problem with group membership evaluator.
here's my share-config-custom.xml snippet

<action id="document-manage-aspects" type="javascript" label="actions.document.manage-aspects">
            <param name="function">onActionManageAspects</param>
            <permissions>
               <permission allow="true">Write</permission>
            </permissions>
            <evaluator negate="true">evaluator.doclib.action.isLocked</evaluator>
         <evaluator>my.evaluator.doclib.action.isManager</evaluator>
         </action>

and here's my context.xml snippet


<bean id="my.evaluator.doclib.action.isManager" parent="evaluator.doclib.action.groupMembership">
         <property name="relation" value="OR" />
         <property name="groups">
            <list>
               <value>GROUP_ALFRESCO_ADMINISTRATORS</value>
               <value>GROUP_DOCUMENT_CONTROLLER</value>
            </list>
         </property>
   </bean>


it only work on admin user only and the member of group DOCUMENT_CONTROLLER doesn't have acces to the actions…

ebrenes
Champ on-the-rise
Champ on-the-rise

You need to prepend the group name with "GROUP_", so it will be something like

<bean id="com.pasello.iso.isoDocumentManagers" parent="evaluator.doclib.action.groupMembership">
   <property name="relation" value="OR"/>
      <property name="groups">
         <list>
            <value>GROUP_isoDocumentManagers</value>
         </list>
      </property>
   </bean>