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.
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.
You gave me great hints for achieving organization prepopulation on self registration. Thanks :)
ReplyDeleteReally nice and definitely it will be useful for many people. Kindly keep update like this.
ReplyDeleteManpower Consultancy in Chennai
Hr Consultancy in Chennai
Recruitment Consultancy in Chennai
Would you be interested in freelancing work.
ReplyDeleteKindly share your contact detail