OIM API for Revoke Role Grants


  1. package com.oimacademy.role;
  2. import java.util.*;
  3. import oracle.iam.identity.rolemgmt.api.RoleManager;
  4. import oracle.iam.identity.vo.IdentityManagerResult;
  5. import oracle.iam.platform.OIMClient;
  6. public class RevokeRoleGrants {
  7.     public static void main(String[] args) throws Exception {
  8.         OIMClient oimClient = LocalTest.newOimClient();
  9.         RoleManager roleManager = oimClient.getService(RoleManager.class);
  10.         String userKey = "8"; // PAHG856
  11.         Set<String> userRoles = new HashSet<>();
  12.         userRoles.add("10"); 
  13.         userRoles.add("11"); 
  14.         // select ugp_key from usg where usr_key = ?
  15.         IdentityManagerResult result = roleManager.revokeRoleGrants(userKey, userRoles);
  16.         // select ugp_key from usg where usr_key = ?
  17.         System.out.println(result.getStatus()); // COMPLETED
  18.         System.out.println(result.getEntityId()); 
  19.         System.out.println(result.getSucceededResults()); 
  20.         System.out.println(result.getFailedResults()); 
  21.     }
  22. }

No comments:

Post a Comment