Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Removing iview permissions for a user

Hello all,

im trying to fetch the permissions to a particular user on a particular iview using the following code:

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,

IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

env.put(Context.SECURITY_PRINCIPAL, request.getUser());

env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);

InitialContext iCtx = null;

String lookupObject = "portal_content/myFolder/myObject";

IUserFactory userFactory = UMFactory.getUserFactory();

IUser myUser = null;

try {

// Create user object for which we want to remove permission

myUser = userFactory.getUserByLogonID("myUser");

// Look up object

iCtx = new InitialContext(env);

IPcdContext myPcdContext =(IPcdContext) iCtx.lookup(lookupObject);

// Get ACL handle

IAclHandle myAclHandle = myPcdContext.getAclHandle();

// Get ACL

IAcl thePerms = myAclHandle.getOwnAcl();

// Get ACEs for specific user

Iterator myIt = thePerms.getAclEntries(myUser).iterator();

while (myIt.hasNext()) {

// Get next ACE

IAclEntry ace = (IAclEntry) myIt.next();

// Remove ACE if it is for USE permissions

if (ace.getPermission().equals(

IPcdStandardPermissions.PCD_PERMISSION_USE)){

thePerms.removeAclEntry(request.getUser(),ace);

}

}

}

here when i try to fetch the permissions thePerms...

the permissions are not getting fetched.

Can anybody help?

Former Member
Not what you were looking for? View more on this topic or Ask a question