Skip to Content
0
Former Member
May 28, 2014 at 11:35 AM

Assigning Users to Roles in NW 7.3 J2EE JAVA

48 Views

Hello All,

I want to assign UME roles that I have created in portal NW 7.3 to users present in the portal using java.

Kindly help me regarding the code how to assign the particular role to the user..

I foung the Procedure but is there any code already available.

Procedure

  1. Use the IUser and IRole interfaces to get the user and role objects.
  2. Check if the user is already directly assigned a member of the role or not.This is to avoid AttributeValueAlreadyExistsException . You cannot avoid this risk completely. There is the remote possibility that another application makes the same role assignment in the time between this check and the actual role assignment.
  3. Use the getMutableRole() method to get a modifiable version of the role object.
  4. Use the addMember() method to assign the user to the role.
  5. Commit your changes.