无法设置 Filenet P8 文件夹的权限

Can't set permissions on Filenet P8 folder

在我当前的项目中,使用 Filenet P8 Content Platform Engine 5.2.1 和 WebSphere 8.5.5.3、Eclipse Mars 4.5.2 和 Apache Maven 3.3.1

我正在尝试使用以下代码向现有文件夹添加一些权限:

public Folder addFolderPermissions(Folder folder) {

    AccessPermission permission = Factory.AccessPermission.createInstance();
    permission.set_GranteeName("AMM_000072_00001");
    permission.set_AccessType(AccessType.ALLOW);
    permission.set_InheritableDepth(-1);
    permission.set_AccessMask(EcmFilenetConsts.ACCESS_READ_FOLDER);
    AccessPermissionList permissions = folder.get_Permissions();
    permissions.add(permission);
    folder.set_Permissions(permissions);
    folder.save(RefreshMode.REFRESH);

    return folder;
}

其中 EcmFilenetConsts.ACCESS_READ_FOLDER = AccessRight.READ.getValue() | AccessRight.READ_ACL.getValue();

已使用以下代码检索文件夹:

String folderID = "{7084AE5B-0000-C817-9E59-B09C18C55230}";
PropertyFilter pf = new PropertyFilter();    
pf.addIncludeProperty(new FilterElement(null, null, null, "Permissions", null));
Folder folder = Factory.Folder.fetchInstance(objectStore, folderID, pf);

问题是当执行 folder.save 指令时出现以下错误:

com.filenet.api.exception.EngineRuntimeException: FNRCE0051E: E_OBJECT_NOT_FOUND: The requested item was not found. propertyName=Permissions, referenced principal=AMM_000072_00001 in Domain {00000000-0000-0000-0000-000000000000} failedBatchItem=0 errorStack={
    at com.filenet.engine.security.SecurityProvider.getSecurityId(SecurityProvider.java:454)
    at com.filenet.engine.security.SecurityProvider.preGetSecurityId(SecurityProvider.java:288)
    at com.filenet.engine.security.SecurityDescriptor.updateOrCreateAce(SecurityDescriptor.java:907)
    at com.filenet.engine.security.SecurityDescriptor.updateAccessPermissionList(SecurityDescriptor.java:713)
    at com.filenet.engine.security.AccessManager.createPersistableSDFromUpdate(AccessManager.java:173)
    at com.filenet.engine.persist.IndependentPersister.preChangeSecurity(IndependentPersister.java:1743)
    at com.filenet.engine.persist.IndependentPersister.executeChange(IndependentPersister.java:329)
    at com.filenet.engine.persist.SubscribablePersister.executeChange(SubscribablePersister.java:177)
    at com.filenet.engine.jca.impl.RequestBrokerImpl.executeChanges(RequestBrokerImpl.java:1487)
    at com.filenet.engine.jca.impl.RequestBrokerImpl.executeChanges(RequestBrokerImpl.java:1345)
    at com.filenet.engine.ejb.EngineCoreBean._executeChanges(EngineCoreBean.java:619)
    at com.filenet.engine.ejb.EngineCoreBean.executeChanges(EngineCoreBean.java:586)
    at com.filenet.engine.ejb.EJSLocalStatelessEngineCore_22877cb1.executeChanges(Unknown Source)
    at com.filenet.engine.ejb.EngineBean.executeChanges(EngineBean.java:913)
    at com.filenet.apiimpl.transport.ejbstubs.EJSLocalStatelessEngine_2e64c374.executeChanges(Unknown Source)
    at com.filenet.apiimpl.transport.ejb.EnginePortLocal.executeChanges(EnginePortLocal.java:53)
    at com.filenet.apiimpl.wsi.ServiceSessionNst.run(ServiceSessionNst.java:1360)
    at java.security.AccessController.doPrivileged(AccessController.java:314)
    at javax.security.auth.Subject.doAs(Subject.java:573)
    at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:195)
    at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:152)
    at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at com.filenet.apiimpl.util.J2EEUtilWS.doAs(J2EEUtilWS.java:239)
    at com.filenet.apiimpl.wsi.ServiceSessionNst.sMakeInternalEJBCall(ServiceSessionNst.java:1223)
    at com.filenet.apiimpl.wsi.ServiceSessionNst.sHandleIncomingRequest(ServiceSessionNst.java:1067)
    at com.filenet.engine.wsi.ListenerNst.service(ListenerNst.java:179)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1227)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:776)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:458)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:909)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.run(AsyncChannelFuture.java:205)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
}
    at com.filenet.apiimpl.wsi.serialization.core.ExceptionSerialization.deserialize(ExceptionSerialization.java:196)
    at com.filenet.apiimpl.wsi.ServiceSessionNst.cDeserializeSoapFault(ServiceSessionNst.java:693)
    at com.filenet.apiimpl.wsi.ServiceSessionNst.cReqRespPath(ServiceSessionNst.java:223)
    at com.filenet.apiimpl.wsi.ServiceSessionNst.executeChanges(ServiceSessionNst.java:85)
    at com.filenet.apiimpl.util.SessionHandle.executeChanges(SessionHandle.java:112)
    at com.filenet.apiimpl.core.Session.callExecuteChanges(Session.java:146)
    at com.filenet.apiimpl.core.Session.executeChanges(Session.java:532)
    at com.filenet.apiimpl.core.Session.executeChange(Session.java:850)
    at com.filenet.apiimpl.core.IndependentlyPersistableObjectImpl.save(IndependentlyPersistableObjectImpl.java:76)
    at com.filenet.apiimpl.core.IndependentlyPersistableObjectImpl.save(IndependentlyPersistableObjectImpl.java:67)
    at com.leonardo.spcic.ecm.filenet.security.SecurityManagerImpl.addFolderPermissions(SecurityManagerImpl.java:44)
    at com.leonardo.spcic.ecm.filenet.security.SecurityManagerImplTest.testAddFolderPermissions(SecurityManagerImplTest.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access[=12=]0(ParentRunner.java:58)
    at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

我也尝试为 fetch 方法设置一个 null propertyFilter,但错误仍然存​​在。

我关注了this set permission example

谁能告诉我我做错了什么?

我认为这个错误与 Permissions 属性 没有任何关系。它会自动获取,以便像 get_Permissions() 这样的方法无条件地工作。

没找到的是校长AMM_000072_00001。您确定它存在于 P8 Domain 使用的目录服务中吗?这是一个完整有效的身份证件吗?