S.Mayuri
S.Mayuri

Reputation: 1

Off / Disable Inheritance Permission from Custom folder

I am trying to create a custom folder in Create menu of Document Library called 'Confidential Folder' in Alfresco. I've attempted the following procedure,

  1. I have used the Alfresco Maven SDK to create a project that will package up my customizations in two AMPs (Alfresco Module Packages). One AMP is for the Alfresco web application (the "repo" tier) and the other is for the Alfresco Share web application (the "Share" tier).

  2. I have added the following code in share-config-custom.xml:

XML:

<config evaluator="string-compare" condition="DocumentLibrary">
    <create-content>
    <content id="confidentialFolder" mimetype="text/plain"
    label="Confidential Folder" itemid="cm:folder" icon="finalize">
            <param name="action">confidential-folder</param>
    </content>
   </create-content>
</config>
  1. In service-context.xml I registered the bean:

XML:

 <bean id="confidential-folder" class="com.finalize.action.executer.ConfidentialFolder"
        parent="action-executer">
    <property name="nodeService">
        <ref bean="NodeService" />
    </property>
</bean>
  1. And wrote the Java class for execute the action which will Off the Inheritance Permission.

Action Executer:

package com.finalize.action.executer;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;

import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.repo.security.permissions;
import org.alfresco.repo.policy.ClassPolicy;

//import org.alfresco.repo.events.EventsService;
public class ConfidentialFolder extends ActionExecuterAbstractBase {
    public static final QName DISABLE = QName.createQName(NamespaceService.ALFRESCO_URI, "onInheritPermissionsDisabled");

    //  protected EventsService eventsService;
    protected NodeService nodeService;

    /* public void setEventsService(EventsService eventsService)
    {
        this.eventsService = eventsService;
    }*/

    public void setNodeService(NodeService nodeService)
    {
        this.nodeService = nodeService;
    }

    /*public void onInheritPermissionsDisabled(NodeRef nodeRef, boolean async)
    {
        inheritPermissionsDisabled(nodeRef, async);
    }*/

    @Override
    protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {

        onInheritPermissionsDisabled(actionedUponNodeRef,false);

        //      private static final QName POLICY_ON_INHERIT_PERMISSIONS_DISABLED = QName.createQName(NamespaceService.ALFRESCO_URI, "onInheritPermissionsDisabled");
        //          nodeService.addAspect(actionedUponNodeRef, QName.createQName(FinalizeModel.NAMESPACE_FINALIZE_CONTENT_MODEL, FinalizeModel.ASPECT_FIN_WEBABLE), properties);

    }

    @Override
    protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
        paramList.add(
                new ParameterDefinitionImpl(               // Create a new parameter definition to add to the list
                        "active",                           // The name used to identify the parameter
                        DataTypeDefinition.BOOLEAN,             // The parameter value type
                        false,                                  // Indicates whether the parameter is mandatory
                        getParamDisplayLabel("active")));   // The parameters display label
    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I wanted to Off or Disable the Inheritance Permission from Confidential folder menu but I am not able to achieve.

Upvotes: 0

Views: 360

Answers (1)

Jeff Potts
Jeff Potts

Reputation: 10538

This is cross-posted on the Alfresco forums here: https://community.alfresco.com/thread/238511-off-disable-inheritance-permission-from-custom-folder and is being discussed, so no need to duplicate it here.

Upvotes: 0

Related Questions