0

我正在尝试在 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
    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

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

4

1 回答 1

0

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

于 2018-08-23T16:25:33.170 回答