Skip to Content
0
Former Member
Jan 18, 2005 at 07:02 PM

Adding ACL entry to KM collection

35 Views

Hello,

I'm tying to grant permission to access KM directory to connected user and some group by code (without try/catch clauses and aGroup fetching):

com.sapportals.portal.security.usermanagement.IUser aUser = (com.sapportals.portal.security.usermanagement.IUser) aRequest.getUser().getUser();

String root = "/documents/timesheet/CV";

String userId = aUser.getId();

IResourceContext resourceContext = new ResourceContext(aUser);

RID rid = RID.getRID(root);

ICollection rootResource = (ICollection) ResourceFactory.getInstance().getResource(rid, resourceContext);

userDirResource = rootResource.createCollection(userId, null);

IResourceAclManager aclMan = ((IAclSecurityManager) userDirResource.getRepositoryManager().getSecurityManager(userDirResource)).getAclManager();

IResourceAcl userDirResourceAcl = aclMan.getAcl(userDirResource);

aclMan.createAclEntry((IUMPrincipal) aUser, false, aclMan.getPermission("read"), 2);

aclMan.createAclEntry((IUMPrincipal) aGroup, false, aclMan.getPermission("fullcontrol"), 1);

... but no ACL is set. I think, I should somehow add created Acl entries to AclList. Or what am I doing wrong?

Best Regards,

Josef Motl