on 07-28-2010 9:10 PM
Hi,
I am trying to add users to MDM and set the Roles for them.
I can do this with the RoleID by number, like this, but I need to set roles for users by role name.
Currently I can do this:
RoleId role1 = new RoleId(5);
RoleId role2 = new RoleId(10);
cmd.User.RoleIds = new RoleId[] { role1,role2 };
But I need to do this more like:
RoleId role1 = new RoleId("Admin");
Is this possible? I can't find a function to get a RoleID by name.
---
Found this:
GetRoleListCommand grlc = new GetRoleListCommand(repSessionCtx);
grlc.Session = repsessiontext;
grlc.execute();
RoleProperties[] roles = grlc.getRoles();
Edited by: Wardell Castles on Jul 28, 2010 4:21 PM
Edited by: Wardell Castles on Jul 28, 2010 5:15 PM
Hi Wardell.
There is no direct API to fetch the RoleId by name. As you mentioned, you can use the roleproperties to fetch the ID and Name.
GetRoleListCommand grlcommand = new GetRoleListCommand(repSessionCtx);
grlcommand.Session = repsessiontext;
grlcommand.execute();
RoleProperties[] roles = grlcommand.getRoles();
for(int i=0;i<roles.length();i++){
RoleProperties rp = roles<i>;
rp.getName(); // You can get the name of the role
rp.getId() // Also you can get the id of the role.
}
Is this what you are looking?
If you have found a solution for your query, please close the thread by saying completed.
Thanks
Bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.