OIM API to Assign Admin Roles To User


  1. package com.oimacademy.users;
  2. import com.oimacademy.connection.Platform;
  3. import oracle.iam.platform.authopss.api.AdminRoleService;
  4. import oracle.iam.platform.authopss.vo.AdminRole;
  5. import oracle.iam.platform.authopss.vo.AdminRoleMembership;
  6. public class AssignAdminRolesToUser {
  7.  public void adminRolesToUser(){
  8.   AdminRoleService arsi = Platform.getService(AdminRoleService.class);  
  9.    String key="137";//Act_Key
  10.   AdminRole ar= arsi.getAdminRole("OrclOIMUserViewer");
  11.         AdminRoleMembership arm = new AdminRoleMembership("5", ar, key, true);
  12.         arsi.addAdminRoleMembership(arm);
  13.         AdminRole ar1= arsi.getAdminRole("OrclOIMOrgAdministrator");
  14.         AdminRoleMembership arm1 = new AdminRoleMembership("5", ar1, key, true);
  15.         arsi.addAdminRoleMembership(arm1);
  16.         System.out.println("done");
  17.  }
  18. }

No comments:

Post a Comment