on 10-14-2009 5:09 AM
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
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!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!!!
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.