on 07-09-2008 8:05 AM
Hi,
I have a portal role to TEST to some of my portal users.
I want to check whether the current user has the role or not using webdynpro.
Hi Vinod..
I have used the code u given...But i have specified role name instead of ID....ID is different from Role? Where can i get this unique id of the role
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Prasanthi,
A role is identified using its unique id. you can see this in the User Administration of portal where select the search criteria as Role and type the role name and on enter you will find its details.
Here you can find the role name, role unique id ( starts with pcd:) and role unique name ( starts with * ROLE.PCD_ROLE_PERSISTENCE.xxxxxxxx*).
Hope you understand and My Ans is right!.
Regards
Vinod
Use this code
This one finds all the users assigned to a role. Specify the unique role id and that will find the current user has the role or not.
try {
com.sap.security.api.IRoleFactory factory = UMFactory.getRoleFactory();
com.sap.security.api.IRole role = factory.getRole( "<Role unique id>");
java.util.Iterator itr = role.getMembers( true);
while( itr.hasNext())
{
if( UMFactory.getUserFactory().getUser( itr.next().toString()).getUniqueName()
.equals( WDClientUser.getCurrentUser().getSAPUser().getUniqueName()))
{
wdComponentAPI.getMessageManager().reportSuccess( "Current user is assigned with role");
}else{ wdComponentAPI.getMessageManager().reportSuccess( "Current user is not assigned with role");
}
}
} catch (UMException e) {
// TODO Auto-generated catch block wdComponentAPI.getMessageManager().reportException( e.getMessage(), true);
e.printStackTrace();
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
regards
Vinod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did you mean that, you have a role assigned to some of the portal users and you want to list those users?
Regards
Vinod V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.