Skip to Content
0
Former Member
Mar 13, 2009 at 08:12 AM

Error while getting the Direct parent group from IUser

8 Views

Dear all,

I'm using KM API's to upload documents to KM through a Webdynpro Application.

The uploading of the document is working correctly. the permission setting to the newly uploaded document is done based on user group in which the user is a member.

This is also working.

While uploading, the user gets a selection screen to choose the area.

If the user is a member of All India that person will get option to select all branches and all areas under each branch.

If the user is a member of any one branch, he can select only areas coming under his branch.

Here the problem starts. (All India is the parent group for all branches, under branch some areas are there.)

User 1 is a member of All India

User 2 is a member of Branch1

If an All India user comes in we give the branch list in a dropdown list. Branch user should not get this dropdown. He's not supposed to upload documents for any other branch.

I am checking the parent group of the user identify his Level. But even if the user is not a member of All India, I'm getting the dropdown to choose the branch.

Please give me your valuable guidance to solve this.

My code for getting the parent group is given below.

public com.sapportals.portal.security.usermanagement.IGroup getParentGroup( com.sapportals.portal.security.usermanagement.IUser ep5User )
  {
    //@@begin getParentGroup()
	   String [] parentGrp=null;
	   IGroup parentGroup=null;
	   try
	   {
		   IGroupFactory groupFact=WPUMFactory.getGroupFactory();
		
		   /* Get all the User groups in which the user is a member */
							
		   String [] userGroup=ep5User.getDirectParentGroups();
		   
		   for(int i=0;i<userGroup.length;i++)
		   {
			   IGroup userGrp=groupFact.getGroup(userGroup<i>);
			   if(userGrp.getId().startsWith("B00") || userGrp.getId().equalsIgnoreCase("ALL_INDIA"))
			   {
			
				   msgMngr.reportSuccess("ID of the group "+userGrp.getId());
				   parentGroup=userGrp;
				   break;	
			   }		
		   }	
	   }
	   catch(UserManagementException e){
		   msgMngr.reportException("UserManagementException"+e,false);
	   }
	   return parentGroup;
    //@@end
  }

Best Regards,

Aparnna