如何在ACM客户端中临时挂起访问控制(AccessControl)的方案:
可以使用SessionServerHelper.manager对象,它是一个SessionManagerSvr接口的实现。
它会临时关闭对AccessControl的验证通道(基于单个MethodContext,或者说是当前线程下),从而绕过在访问ACM服务端资源(如WTDocument,EPMDocument等)时的权限要求。
以下是SessionManagerSvr接口方法setAccessEnforced的javadoc描述:
setAccessEnforced
boolean setAccessEnforced(boolean enforce)
Suspends or resumes all access & authorization enforcement. If the argument is false then access/authorization enforcement is suspended; otherwise it is resumed. The method returns true if the access/authorization checks are being enforced or false otherwise.
This method can be used to temporarily suspend access/authorization enforcement using a try/finally block, in which the enforcement is suspended in the try block and restored in the finally block. The return value can be used to restore the value to whatever it was before the enforcement was suspended.
我们可以在try段中通过setAccessEnforced(false),然后在finally段中再把setAccessEnforced(true)