cancel
Showing results for 
Search instead for 
Did you mean: 

how to get group in webdynpro

Former Member
0 Kudos

Hi Friends,

I had created role based application in webdynpro.i get the roles in webdynpro and based on the role i changed the display in the appliation.

I had used below code

IWDClientUser user = WDClientUser.getLoggedInClientUser();
epUser = user.getSAPUser();
try {
Iterator rolelist = epUser.getRoles(false);
if(rolelist!=null)
{
  while(rolelist.hasNext())
  {
  String strRole=rolelist.next().toString();
  IRole role= UMFactory.getRoleFactory().getRole(strRole);
if(role.getDisplayName().equalsIgnoreCase("Test1"))
  {
  .......
}
else if(role.getDisplayName().equalsIgnoreCase("Test2")) 
{
.....
}
}
 Catch(Exception e)
{}

Now my problem is in dev and i tested the applciation and its working fine but in production we created groups and assinged users to groups and finally we assigned roles to tha groups.

But the process s not working. Can any one tell me why it happens.

Regards,

Suresh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Suresh,

May be i am wrong, but i don't think so code will be a problem, coz at last you have to compare role based on the user.

Could you plz try to print the role name which you are getting from the production and cross check with the role you are trying to compare.

while(rolelist.hasNext())

{

String strRole=rolelist.next().toString();

IRole role= UMFactory.getRoleFactory().getRole(strRole);

// try to print role name here

Hope this may help you.

Deepak!!!

Former Member
0 Kudos

HI Deepak,

Thanks for reply,

In production if we assign roel to user directly with out group then its working fine.

I find the problem that i need to get groups in webdynpro and search for the role.

Can you please tell me that how to get portal groups in webdynrpo.

Regards,

Suresh

Former Member
0 Kudos

Hi Suresh,

Plz check below line of code:-

// initialize

boolean userHasRole = false;

String roleName = "pl.com.bcc.AuthorityRole";

// an exception should not occur

try {

// get webdynpro user

IWDClientUser wdcu = WDClientUser.getCurrentUser();

// get sap WAS user for WD user

IUser sapUser = wdcu.getSAPUser();

// get role for name

IRole sapRole = UMFactory.getRoleFactory().getRole(roleName);

* // check if user is member of role,*

* // the "true" attribute means, that role assignment might be*

* // indirect (ie. for a group in which user is a member* userHasRole = sapRole.isUserMember(sapUser.getUniqueID(), true);

// return a message in case of exception

} catch (WDUMException e1) {

wdComponentAPI.getMessageManager().reportWarning(

"Error when obtaining user information : " + e1.getMessage());

} catch (UMException e2) {

wdComponentAPI.getMessageManager().reportWarning(

"Error when obtaining user information : " + e2.getMessage());

}

// the userHasRole variable is true, if current user has the named role

Plz check this thread:-http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417600)ID0529938150DB10355598804082215221End...

Hope this may help you..mean while i m trying to get something.....:)

Deepak!!!

Answers (0)