on 11-08-2012 1:41 PM
Hi All,
I am developing one application to assign portal roles and users to a group at the time of new group creation using WebDynpro java coding.
So I have manage to add the users to that group but not being able to add roles to that group.
So can anyone please suggest me how to do this.
Thanks & Regards
Mainak
Hi Maniak!
I guess you are using an IGroup instance. You can add an IGroup instance to a role with a known name using the IGroup.addToRole(String roleName) method. There are also methods like removeFromRole(String roleName) and getRoles(boolean recursive). If you've got the IRole instance, you can use IRole.addGroupMember(String groupName) to add a Group to the IRole instance. Funny enough, there are no methods to add an IGroup instance to an IRole instance, though...
Hth
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
O.k., you might go with something like this (unchecked code, so be careful for typos or the like...)
IGroupFactory gf = UMFactory.getGroupFactory();
IGroup group = factory.getGroup("YourGroup.Name.GoesHere");
// if you are to create a group, use
// IGroup group = factory.newGroup(String);
// group.save();
// Maybe you'll have to commit here:
// group.commit();
group.addToRole("YourRole.Name.GoesHere");
group.save();
group.commit();
hth
Michael
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.