关闭/从“自定义”文件夹禁用继承权限

时间:2018-08-21 07:09:26

标签: alfresco alfresco-share alfresco-maven

我试图在Alfresco的文档库的“创建”菜单中创建一个名为“机密文件夹”的自定义文件夹。我尝试了以下过程,

  1. 我已经使用Alfresco Maven SDK创建了一个项目,该项目会将我的自定义内容打包在两个AMP(Alfresco模块包)中。一个AMP用于Alfresco Web应用程序(“ repo”层),另一个用于Alfresco Share Web应用程序(“ Share”层)。

  2. 我在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. 我在service-context.xml中注册了bean:

XML:

 <bean id="confidential-folder" class="com.finalize.action.executer.ConfidentialFolder"
        parent="action-executer">
    <property name="nodeService">
        <ref bean="NodeService" />
    </property>
</bean>
  1. 并编写了Java类来执行将取消继承权限的操作。

动作执行者:

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
    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

我想从机密文件夹菜单中关闭或禁用继承权限,但是我无法实现。

1 个答案:

答案 0 :(得分:0)

此内容交叉发布在Alfresco论坛的https://community.alfresco.com/thread/238511-off-disable-inheritance-permission-from-custom-folder上,正在讨论中,因此无需在此处重复。