cancel
Showing results for 
Search instead for 
Did you mean: 

WriteContent permission, PermissionDefinitions.xml and Share Actions

matthewpatin
Champ in-the-making
Champ in-the-making
Hi everyone,

I'm trying to create some custom permission groups and then show or hide share actions based on permissions inherited from these groups.

For example, I can define a "VersionerOnly" permission group, who can only read properties and content and who only has write access to the content.

    <!–  Only upload new versions –>
      <permissionGroup name="VersionerOnly" allowFullControl="false" expose="true">
         <includePermissionGroup permissionGroup="Read" type="sys:base" />
         <includePermissionGroup type="sys:base" permissionGroup="WriteContent"/>
      </permissionGroup>


What I want to do is now set up the upload new version action in share to only be available for those with writecontent permission, not just write permission (write is writecontent and writeproperties). Like so:

         <!– Upload new version –>
         <action id="document-upload-new-version" type="javascript" label="actions.document.upload-new-version">
            <param name="function">onActionUploadNewVersion</param>
            <permissions>
               <permission allow="true">WriteContent</permission>
            </permissions>
            <evaluator>evaluator.doclib.action.upload</evaluator>
            <evaluator>evaluator.doclib.action.editableByCurrentUser</evaluator>
            <evaluator negate="true">evaluator.doclib.metadata.isLocked</evaluator>
         </action>

I'm quite sure the user I'm testing with has the VersionerOnly role (only gets the read interfaces components), BUT the upload a new version button isn't displaying. I've also tried checking the action with a collaborator, who definitely has writecontent permission as well, and the action is not show.

I've tried setting the expose to true for the WriteContent permission, in case that's why share is ignoring the WriteContent permission:

      <permissionGroup name="WriteContent" expose="true" allowFullControl="false" />

So I guess my question is, why doesn't share see/use WriteContent permission in its actions? Is there further configuration required to expose the WriteContent permission in Share?

Thank you very much for your help.

Regards,
Matthew


1 REPLY 1

matthewpatin
Champ in-the-making
Champ in-the-making
Some follow up:

I found this bean in Alfresco and extended it to show WriteContent as well.

<bean id="baseJsonConversionComponent" abstract="true">
        <property name="nodeService" ref="NodeService"/>
        <property name="publicServiceAccessService" ref="PublicServiceAccessService" />
        <property name="namespaceService" ref="NamespaceService" />
        <property name="fileFolderService" ref="FileFolderService" />
        <property name="lockService" ref="LockService" />
        <property name="permissionService" ref="PermissionService" />  
        <property name="contentService" ref="ContentService" />
        <property name="userPermissions">
            <list>
                <value>CancelCheckOut</value>
                <value>ChangePermissions</value>
                <value>CreateChildren</value>
                <value>Delete</value>
                <value>Write</value>
           <value>WriteContent</value>
            </list>
        </property>
    </bean>

Now, when I'm tracing out the json in the evaluator, I can see the permission, but I'm still unable to display the upload new version button based on it. Its strange because I only see the permissions if in the document library. In the details they dont show up…

{"node":{"isLink":false,"permissions":{"roles":["ALLOWED;enisaversionar;All;DIRECT","ALLOWED;ROLE_OWNER;All;DIRECT","ALLOWED;GROUP_EVERYONE;Consumer;DIRECT"],"inherited":false,"user":{"ChangePermissions":true,"CancelCheckOut":false,"WriteContent":true…

Thanks,
Matthew