on 07-26-2005 7:40 AM
Hi,
I read about How to manage authorization in Webdynpros. It talks about the hasPermission method, which is linked to actions, which is further linked to Roles.
Is there any direct method which can be used to access the Role of the current user which can later be used to restrict the Visibility of certain UI Elements in the Webdynpro application.
Can the method "isMemberOfRole" be of any significant use?
Regards
Meesum
Hi Meesum
If you want the authorization for the individual UI elements , You need to go with Java permissions.
For getting all the Roles of the logged in user, Use
UMFactory.getRoleFactory()..
Regards
NagaKishore V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Meesum,
You can make use of following
user.getSAPUser().isMemberOfGroup();
Example :
IWDClientUser user = WDClientUser.getCurrentUser();
IUser userID = user.getSAPUser();
String Userrole=new String();
for (Iterator iter = userID.getRoles(true); iter.hasNext();) {
IRole role = UMFactory.getRoleFactory().getRole((String) iter.next());
Userrole=role.getUniqueName();
}
if(Userrole.equalsIgnoreCase("Administrator"))
// TO DO
Regards, Anilkumar
Message was edited by: Anilkumar Vippagunta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am also trying to get some unique userid from the logged in user.
'IWDClientUser user = WDClientUser.getCurrentUser();' works, but IUser, IRole and UMFactory can not be resolved.
Even 'Organize Imports' does not help.
And when I try to import com.sap.security.api.IUser manually, I get an error message during build which tells me that the classes could not be found and that I should fix my build path.
Can anyone tell me what to import etc. to get Developer Studio to resolve IUser, IRole and UMFactory?
hi
you can get the userid of the logged in user and his role from webdynpro using the following code
IUser user = request.getUser();
Iterator roles = user.getRoles(true);
while (roles.hasNext()) {
try {
String uniqueID = roles.next().toString();
IRole userRole = UMFactory.getRoleFactory().getRole(uniqueID);
if(userRole.getDisplayName().equalsIgnoreCase("elearningclient"))
response.write("Role is :"+userRole.getDisplayName());
} catch (Exception e) {
response.write(""+e);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.