Hi everyone,
I have set modify permission to user for epm document, but unable to open that epm document by using non admin user login credentials.
Please check below code with exception and do let me know if anything is missing.
public void setAdHocAccess(List<EPMDocument> listEPM, WTUser user) throws WTException {
boolean en = SessionServerHelper.manager.setAccessEnforced(false);
try {
ContainerTeamManaged container = null;
if (user != null) {
Vector<AccessPermission> accessPermission = new Vector<AccessPermission>();
// set Modify permission
System.out.println("Set Modify access for objects..!");
accessPermission.add(AccessPermission.MODIFY);
for (EPMDocument epm : listEPM) {
container = (ContainerTeamManaged) epm.getContainer();
System.out.println("=== Grant Access to CAD Documents ==== " + epm.getNumber()
+ " FROM CONTEXT: " + epm.getContainer().getContainerName());
// set Principal AdHoc Access control
ContainerTeamHelper.service.setPrincipalAdHocAcl(container, (AdHocControlled) epm,accessPermission,user);
}
} else {
System.out.println("user not found skip ad hoc access");
}
System.out.println("--------------------------------------");
} catch (WTException ex) {
ex.printStackTrace();
} finally {
SessionServerHelper.manager.setAccessEnforced(en);
}
}
Exception :
ERROR : wt.access.evaluation.report demouser1 - "demouser1" does not have Read permission for "CAD Part - 0000000023.dwg, A.1" in Administrative Domain "Site, Organization - Demo Organization, Product - ProductView Demo /Default".
ERROR : com.ptc.mvc.controllers.ExceptionController demouser1 - message : ATTENTION: Secured Action. You do not have the necessary authorization for this operation. Contact your administrator if you believe you have received this message in error.
error:-------------wt.util.WTRuntimeException: ATTENTION: Secured Action. You do not have the necessary authorization for this operation. Contact your administrator if you believe you have received this message in error. Nested exception is:
(wt.access.accessResource/19) wt.access.NotAuthorizedException: ATTENTION: Secured Action. You do not have the necessary authorization for this operation. Contact your administrator if you believe you have received this message in error.
Thanks.