cancel
Showing results for 
Search instead for 
Did you mean: 

IResourceACLManager.getInheritedAcl(resource) is returning NULL

rami_reddy4
Participant
0 Kudos

Hello Everyone,

Using below Web Dynpro Java code I am capturing all KM Resource groups & Permissions. But if the KM resource having only one group (Everyone group) I am  getting null value. I have tried to use getACL & getInheritedAcl methods but still I am getting null values.

I am unable to get the groups & permission when KM Resource having only Everyone group.

Please find the below webdynpro Java code.

---------------------------------------------------------------------------------------------------------------------------------------

serviceUser = (IUser)WPUMFactory.getServiceUserFactory().getServiceUser(Admin_Service_User);
IResourceContext resourceContext = new ResourceContext(serviceUser);

IResourceFactory resourseFactory = ResourceFactory.getInstance(); 

//RID rid = RID.getRID("/documents");  //documents folder having only Everyone group 

RID rid = RID.getRID("/documents/Content");  // Content fodler having only Everyone group

IResource resource = resourseFactory.getResource(rid, resourceContext);

ISecurityManager secMgr = resource.getRepositoryManager().getSecurityManager(resource);

if(null!= secMgr  && (secMgr instanceof IAclSecurityManager)) {
IResourceAclEntryListIterator rAclEntryList =null;
IResourceAclEntry rAclEntry = null;
IAclSecurityManager aclSecMgr = null;
IResourceAclManager rAclMgr = null;
IResourceAcl resAcl = null;
  
aclSecMgr = (IAclSecurityManager)secMgr;
rAclMgr = aclSecMgr.getAclManager();  
resAcl = rAclMgr.getAcl(resource);
  
wdComponentAPI.getMessageManager().reportSuccess("Get ACL:"+resAcl);    // getting null value
wdComponentAPI.getMessageManager().reportSuccess("Get Inherited ACL:"+rAclMgr.getInheritedAcl(resource)); // getting null value

      
if (null!= resAcl) {   
  for(rAclEntryList = resAcl.getEntries().iterator(); rAclEntryList.hasNext();) {       

     rAclEntry = rAclEntryList.next();
     
    IPrivateKM_ResourceView.IKmRootFolderPermissionsElement kmRootPermissions = wdContext.createKmRootFolderPermissionsElement();
    
  kmRootPermissions.setGroupName(rAclEntry.getPrincipal().getDisplayName());
  kmRootPermissions.setPermissions(rAclEntry.getPermission().getDescription());
  kmRootPermissions.setRootFolderPath(rid.getPath());
     
  wdContext.nodeKmRootFolderPermissions().addElement(kmRootPermissions);           
    }       
}    
   }

Any immediate response is very helpful and will be awarded with high points.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Rami, try to do it in this manner:

...


   //try to get explicit permissions first

   IResourceAcl resourceAcl = resourceAclManager.getAcl(resource); 

   if(resourceAcl == null){ resourceAcl = resourceAclManager.getInheritedAcl(resource); } //fallback for inherited

   if(resourceAcl != null){



  IResourceAclEntryList perm = resourceAcl.getEntries();



  IResourceAclEntryListIterator it = perm.iterator();



  while(it.hasNext()){




  IResourceAclEntry e = it.next();


rami_reddy4
Participant
0 Kudos

Hi Lawrence,

Thanks for your reply.

But still I am getting null values when I use above code. My requirement is to get the KM Resource Root folder permissions. But root folder is having only Everyone Group. Please find the below code with output.

Output

1) Is it possible to get the permission when KM resource having only Everyone Group? If its possible how  to get the permission.

2) If its not possible, using if (rAclMgr.getInheritedAcl(resource) == null ) code we can skip the KM Resources if KM resources having only Everyone group. Is it correct ?

Thanks in advance

    

Regards,

Rami

Former Member
0 Kudos

Hi Rami,

1) Is it possible to get the permission when KM resource having only Everyone Group? If its possible how  to get the permission.

Its not a question about how the permissions looks like, its more about how they are set: explicitely or trough inheritance.

2) If its not possible, using if (rAclMgr.getInheritedAcl(resource) == null ) code we can skip the KM Resources if KM resources having only Everyone group. Is it correct ?

Nearly, I would phrase it a little bit different. If you cant get ACLs, neither explicit nor inherited, the ressource must be in a kind of "initial" state, which means "Everyone" group entry. In that case you can only create some explicit ACL entries, if I remember correctly no permission owner is set in such a case at all.

My requirement is to get the KM Resource Root folder permissions.

This statement and your RID irritates me: /documents/Root Folder is not delivered by default, its a custom created folder. So to be clear, if you didnt set ACL's of this ressource explicit, and also not on your root folder (documents), in that case you will get null for both cases: getInheritedAcl and getAcl.

I hope its considerable and helps a little bit,

regards

rami_reddy4
Participant
0 Kudos

Thanks Lawrence for helping the above issue. Issue was closed.

Answers (0)