on 01-16-2007 5:37 AM
try{
Iterator rit = null;
IWDClientUser clientUser = WDClientUser.getCurrentUser();
IUser user = clientUser.getSAPUser();
rit = user.getRoles(true);
String post=new String();
IRoleFactory rfact = UMFactory.getRoleFactory();
while (rit.hasNext()) {
String roleName = (String) rit.next();
IRole role = rfact.getRole(roleName);
post=role.getDisplayName();
//this method is wrong and not dynamic
//TODO: check the login user from which group he/she belong
if(user.isMemberOfGroup("super_admin_role",true)==true){
//do something
}
if(post.equalsIgnoreCase("Administrator") || post.equalsIgnoreCase("super_admin_role")){
//do something
}
}
}catch(WDUMException wd){
wd.printStackTrace();
}catch(UMException e){
e.printStackTrace();
}
this code iterate the members within the Everyone group which i only what to check the specific login user group
try{
IUserFactory myUF=UMFactory.getUserFactory();
IGroup grp=UMFactory.getGroupFactory().getGroupByUniqueName("Everyone");
Iterator userMembers=grp.getUserMembers(true);
ArrayList aUser=new ArrayList();
while(userMembers.hasNext()){
String userID=(String)userMembers.next();
IUser myUser=myUF.getUser(userID);
aUser.add(myUser.getDisplayName());
}
}catch(Exception ex){
ex.printStackTrace();
}
Message was edited by:
yzme yzme
Message was edited by:
yzme yzme
ANYONE KNOW HOW TO RETRIEVE THE USER GROUP IT BELONGS TO BASED ON THE PARTICULAR LOGIN USER
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This code returns the iterator containing the user groups. Once you have called it, you have to loop this iterator while hasnext = false.
<b> try{
IWDClientUser clientuser = WDClientUser.getCurrentUser();
IUser user = clientuser.getSAPUser();
Iterator userGroups = null;
userGroups = user.getParentGroups(true);
}
catch(Exception ex){
wdThis.wdGetAPI().getComponent().getMessageManager().raiseMessage( IMessageYSP_CRM_CP_COCKPIT.USER_E , null,true);
}</b>
userGroups has the groups.
Don't forget to loop the iterator in try statement.
I Hope it can work
Grites!
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.