Skip to main content

Auto Approval for Self-Register Users- OIM 11g R2

For Auto Approving the self register user we need to do below steps:
1. Create an Event handler to Prepopulate the organisation key for the users.
2. Create an auto approval policy for Request level self register users.
3. Create an auto approval policy for Operational level self register users.


Create an Event handler to Prepopulate the organisation key for the users:

Create a class to prepopulate the Organisation value. Below is the sample code to do that.

package com.oracle.oim.utility.eventhandler;
import java.io.PrintStream;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Set;
import oracle.iam.identity.exception.OrganizationManagerException;
import oracle.iam.identity.orgmgmt.api.OrganizationManager;
import oracle.iam.identity.orgmgmt.vo.Organization;
import oracle.iam.identity.usermgmt.api.UserManagerConstants;
import oracle.iam.identity.usermgmt.api.UserManagerConstants.AttributeName;
import oracle.iam.identity.usermgmt.api.UserManagerConstants.Operations;
import oracle.iam.platform.Platform;
import oracle.iam.platform.context.ContextAware;
import oracle.iam.platform.kernel.spi.PreProcessHandler;
import oracle.iam.platform.kernel.vo.AbstractGenericOrchestration;
import oracle.iam.platform.kernel.vo.BulkEventResult;
import oracle.iam.platform.kernel.vo.BulkOrchestration;
import oracle.iam.platform.kernel.vo.EventResult;
import oracle.iam.platform.kernel.vo.Orchestration;

public class CustomPrepopulateHandler
  implements PreProcessHandler
{
  private static final String ORG_NAME = "Xellerate Users";
  private static final String ORG_KEY_ATTR = "act_key";
  
  public CustomPrepopulateHandler()
  {
    UserManagerConstants i = null;
    UserManagerConstants.Operations o = null;
  }
  

  public EventResult execute(long processId, long eventId, Orchestration orchestration)
  {
    System.out.println("CustomPrepopulateHandler: Inside execute");
    EventResult result = new EventResult();
    String operation = orchestration.getOperation();
    long org_key = 0;
    

      org_key = 1;
      
      System.out.println("CustomPrepopulateHandler: Calling orchestration.addParameter with org_key= " + org_key + " and operation= " + operation);
      orchestration.addParameter(UserManagerConstants.AttributeName.USER_ORGANIZATION.getId(), Long.valueOf(org_key));
      System.out.println("CustomPrepopulateHandler: After orchestration");
    System.out.println("CustomPrepopulateHandler: Exiting the Execute funstion");
    return result;
  }
  
  public BulkEventResult execute(long l, long l1, BulkOrchestration bulkOrchestration)
  {
    return null;
  }
  
  public void compensate(long l, long l1, AbstractGenericOrchestration abstractGenericOrchestration) {}
  
  public boolean cancel(long l, long l1, AbstractGenericOrchestration abstractGenericOrchestration)
  {
    return false;
  }
  
  public void initialize(HashMap<String, String> hashMap) {}
}

PS : Above code is hard coded for Xellarate Organization. We can fetch the Orgnaization on the run time also.


Create Event-handler.xml file and put it in the META-INF folder of the plugin. Sample is as below:


<?xml version="1.0" encoding="UTF-8"?>
<eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
<action-handler class="com.oracle.oim.utility.eventhandler.CustomPrepopulateHandler" entity-type="User" operation="CREATE" name="CustomPrepopulateHandler" stage="preprocess" order="1000" sync="TRUE"/>
</eventhandlers>

Create Plugin.xml and put it in Parallel to META-INF folder. Sample is as below:


<?xml version="1.0" encoding="UTF-8"?>
<oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
    <plugin pluginclass="com.oracle.oim.utility.eventhandler.CustomPrepopulateHandler"
        version="1.0"
        name="CustomPrepopulateHandler">
    </plugin>
   </plugins>
</oimplugins>

Create an auto approval policy for Request level self register users.

Login to Sysadmin console as administrator and create an Approval policy as below:



Create a Simple Approval Rule to trigger the Approval Policy.


Create an auto approval policy for Operation level self register users.



Login to Sysadmin console as administrator and create an Approval policy as below:



Create a Simple Approval Rule to trigger the Approval Policy.









Comments

  1. You gave me great hints for achieving organization prepopulation on self registration. Thanks :)

    ReplyDelete
  2. Really nice and definitely it will be useful for many people. Kindly keep update like this.

    Manpower Consultancy in Chennai

    Hr Consultancy in Chennai

    Recruitment Consultancy in Chennai

    ReplyDelete
  3. Would you be interested in freelancing work.

    Kindly share your contact detail

    ReplyDelete

Post a Comment

Popular posts from this blog

Developing Prepopulate Adapter with OIM 11g R2

1.      Prepopulate Adapter in OIM uses the plugin point oracle.iam.request.plugins.PrePopulationAdapte r. 2.      Write the Java code which returns the value which has to be populated on the form. 3.      This code will implement the plugin point oracle.iam.request.plugins.PrePopulationAdapte r. Code Snippet: - package com.oracle.oim.utility.eventhandler; import java.io.Serializable; import java.util.Iterator; import java.util.List; import java.util.logging.Logger; import oracle.iam.identity.exception.NoSuchUserException; import oracle.iam.identity.exception.UserLookupException; import oracle.iam.identity.usermgmt.api.UserManager; import oracle.iam.identity.usermgmt.vo.User; import oracle.iam.platform.Platform; import oracle.iam.platform.authz.exception.AccessDeniedException; import oracle.iam.request.exception.RequestServiceException; import oracle.iam.request.vo.Beneficiary; import oracle.iam.request.vo.RequestData; public c

OIM Tuning

Application Module tuning is a critical setting which will affect the UI performance. Following are the recommended application module settings for OIM and these are already set out-of-box (OOB) in later releases of OIM 11g R2. Ensure that these settings are implemented as recommended in your environment. -Djbo.ampool.doampooling=true -Djbo.ampool.minavailablesize=1 -Djbo.ampool.maxavailablesize=120 -Djbo.recyclethreshold=60 - Djbo.ampool.timetolive=-1 -Djbo.load.components.lazily=true - Djbo.doconnectionpooling=true -Djbo.txn.disconnect_level=1 - Djbo.connectfailover=false -Djbo.max.cursors=5 - Doracle.jdbc.implicitStatementCacheSize=5 - Doracle.jdbc.maxCachedBufferSize=19 open DOMAIN_HOME/bin/setDomainEnv.sh file for the WebLogic Server instance.find these lines: JAVA_OPTIONS="${JAVA_OPTIONS}" export JAVA_OPTIONS and change it to: JAVA_OPTIONS="-Djbo.ampool.doampooling=true -Djbo.ampool.minavailablesize=1 -Djbo.ampool.maxavailablesize=120 -D

Creating Role through OIM API - 11gR2

package com.oim.utilities; import java.util.HashMap; import oracle.iam.identity.rolemgmt.api.RoleManager; import oracle.iam.identity.rolemgmt.api.RoleManagerConstants; import oracle.iam.identity.rolemgmt.vo.Role; import oracle.iam.platform.OIMClient; public class RoleManagement  { static RoleManager roleManager=null; static OIMClient client=null; @SuppressWarnings("null") public static void createRole(String roleName){ System.out.println("RoleManagement :: createRole :: role name is "+roleName); try  { if (roleName!=null) { HashMap<String, Object> mapAttrs = new HashMap<String, Object>();; mapAttrs.put(RoleManagerConstants.ROLE_NAME, roleName); mapAttrs.put(RoleManagerConstants.ROLE_DISPLAY_NAME,roleName); mapAttrs.put(RoleManagerConstants.ROLE_DESCRIPTION, roleName); Role role = new Role(mapAttrs); // Initialising the OIM Connection client=ClientOIM.initialise(); System.out.println("RoleManagemen