cancel
Showing results for 
Search instead for 
Did you mean: 

Read KM ACL Null Pointer

christiansche
Active Participant
0 Kudos

Hello,

I'm just trying to read the ACLs of some portal ressources. I found some threads that describe exactly what I want to do. But all this threads are resolved and it seems, nobody gets the same error. Following, there is my code. A little shortened without try/catches. The Problem is, that I get a NullPointerException in the Line

"IResourceAclEntryList acllist = acl.getEntries();" this means to me, that I get the IResourceAclManager, but I don't get any ACLs. Has anybody a clue, why I don't get an ACLs?

Best regards,

Christian


com.sap.security.api.IUser sapUser = request.getUser();
com.sapportals.portal.security.usermanagement.IUser ep5User = null;
ep5User = com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);

ResourceContext context = new ResourceContext(ep5User);
RID rid = RID.getRID("/documents");
IResourceFactory factory = ResourceFactory.getInstance();

ICollection folder = (ICollection) factory.getResource(rid, context);

ArrayList al = new ArrayList();

IResourceListIterator it = folder.getChildren().listIterator();

if (it != null) {

	while (it.hasNext()) {

		IResource res = it.next();
		String name = res.getName();
		String rawRid = res.getRID().toString();
		boolean isFolder = res.isCollection();

response.write(name);
		IResourceFactory resFactory = ResourceFactory.getInstance();
		IRepositoryServiceFactory repServiceFactory = resFactory.getServiceFactory();
		IAclService aclService = 
(IAclService) repServiceFactory.getRepositoryService(res, "ServiceAclRepositoryService");
		IResourceAclManager aclMgr = aclService.getAclManager();
		IResourceAcl acl = aclMgr.getAcl(res);
		if (acl == null) {
			response.write("ACL = NULL");
			acl = aclMgr.getInheritedAcl(res);
		}
		IResourceAclEntryList acllist = acl.getEntries();
		IResourceAclEntryListIterator listIt = acllist.iterator();
	}
}


View Entire Topic
christiansche
Active Participant
0 Kudos

A great thank you to BP.

Best regards,

Christian