Skip Headers
Oracle® Mail Administrator's Guide
10g Release 1 (10.1.1)

Part Number B14491-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

I Plugin for Oracle Mail User Provisioning Customizations

This appendix contains information necessary for using a plugin for Oracle Mail user provisioning. It contains examples of various provisioning operations, including:

To use a policy plugin for Oracle Mail user provisioning customizations, implement a class named oracle.mail.provisioning.policy.EmailCustomPolicyPlugin containing the customization code. This class must implement the interface oracle.mail.provisioning.plugin.EmailPolicyPluginInterface present in the $ORACLE_HOME/jlib/esprovisioning.jar file.

Customizations similar to the following examples, according to customer requirements, can be done by implementing this policy interface.

package oracle.mail.provisioning.policy;

import oracle.mail.provisioning.plugin.EmailPolicyPluginInterface;
import oracle.idm.user.IdmUser;
import oracle.idm.provisioning.plugin.ApplicationContext;
import oracle.idm.provisioning.plugin.PluginException;
import oracle.idm.provisioning.plugin.PluginStatus;
import oracle.ldap.util.LDIF;
import oracle.ldap.util.ModPropertySet;

In order to make any customizations during Oracle Mail user creation through a centralized provisioning framework, administrators must implement additional code. This code must be in a class called EmailCustomPolicyPlugin contained in the oracle.mail.provisioning.policy package. This class must implement the oracle.mail.provisioning.plugin.EmailPolicyPluginInterface policy interface.

Any changes made by administrator implementation will eventually be merged by the centralized provisioning framework and will go into effect when a user is created.

public class EmailCustomPolicyPlugin implements EmailPolicyPluginInterface {

The processPolicy method in the EmailCustomPolicyPlugin class is invoked by the Oracle Mail pre-data entry plugin. If, in a deployment any customizations are required, this method must be implemented.

The centralized provisioning framework passes two ModPropertySet objects containing changes made to baseuser attributes and mailuser attributes so far in the e-mail pre-plugin. The baseuser attributes and mailuser attributes are the attributes for the base user and Oracle Mail user, respectively. When the Oracle Mail provisioning plugin invokes the implemented plugin, it passes the original ModPropertySet for the baseuser attribute containing base user attributes passed by the centralized provisioning framework to the Oracle Mail plugins, and two additional ModPropertySet instances for baseuser and mailuser attribute changes, respectively.

If changes need to be made to any baseuser attribute, such as deriving a user ID based on first name and last name, those changes must be done in the ModPropertySet for the base user changes.

Similarly, make changes to the mailuser attribute, such as assigning an Oracle Collaboration Suite Database or changing quota, in the ModPropertySet for mail user changes.

The processPolicy method and its parameters are, as follows:

public void processPolicy(ApplicationContext appCtx,
                          IdmUser idmUser,
                          ModPropertySet originalBaseUserAttrs,
                          ModPropertySet originalMailUserAttrs,
                          ModPropertySet modifiedBaseUserAttrs,
                          ModPropertySet modifiedMailUserAttrs,
                          PluginStatus pluginStatus)
    throws PluginException {

See Also:

Oracle Internet Directory API Reference for more information

Generating a User ID Based on User's First and Last Names

This example generates a user ID, assigns an Oracle Collaboration Suite Database, and establishes mail quota during user creation.

String op_type = appCtx.getCallOp();
 if (op_type.equals(ApplicationContext.OP_CREATE)) {

The preceding code checks if it is a create operation.

String firstname = originalBaseUserAttrs.getModPropertyValue("givenname");
String lastname = originalBaseUserAttrs.getModPropertyValue("sn");
 if ((firstname != null) && (lastname != null)) {
  String mailid = firstname + "." + lastname + "@foo.com";

The preceding code generates the user ID from the firstname and lastname of the base user.

modifiedBaseUserAttrs.deleteProperty("mail");
modifiedBaseUserAttrs.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"mail", mailid);
      }

Assigning an Oracle Collaboration Suite Database Based on Country

This example assigns an mailstore based on the country in which the user resides or works. This example assumes the following:


Oracle Collaboration Suite Database assignment is according to the user country
Country information is stored in the c attribute of the base user
Oracle Collaboration Suite Database name for the USA is usdb.foo.com
Oracle Collaboration Suite Database name for India is indb.foo.com
Oracle Collaboration Suite Database for all other users is ocsms.foo.com
String country = originalBaseUserAttrs.getModPropertyValue("c");
      if (country != null) {
         String mailstore = "ocsms.acme.com";
              if (country.equalsIgnoreCase("usa"))
                 mailstore = "usdb.acme.com";
              if (country.equalsIgnoreCase("india"))
                 mailstore = "indb.acme.com";

modifiedMailUserAttrs.deleteProperty("orclmailstore");
modifiedMailUserAttrs.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"orclmailstore", mailstore);
      }

Establish Mail Quota Dynamically Based on Title

This example assigns higher mail quota to managers, while for all other users, default mail quota that is set at the domain level applies. This example assumes the following:


The title attribute of the base user is Manager for managers
Assign 200MB of mail quota to managers
String title = originalBaseUserAttrs.getModPropertyValue("title");
if ((title != null) && (title.equalsIgnoreCase("manager"))) {

modifiedMailUserAttrs.deleteProperty("orclmailquota");
modifiedMailUserAttrs.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD,"orclmailquota", "200");
      }

Selectively Provision Users for Oracle Mail

This example provisions users selectively. This example assumes the following:


If the title attribute of the base user is temporary, do not provision
if ((title != null) && (title.equalsIgnoreCase("temporary"))) {
  pluginStatus.setProvStatus(IdmUser.PROVISION_NOT_REQUIRED);
      }
    }
  }
}

Setting the provisioning status to PROVISION_NOT_REQUIRED causes Oracle Delegated Administration Services to show no provisioning for Oracle Mail and Oracle Directory Integration and Provisioning does not create an Oracle Mail user.

If the custom plugin requires any base user attributes other than mail, run the oidprovtool utility in the Applications Tier or infrastructure ORACLE HOME to add the additional attributes, as in the following example, where cn and sn attributes are added:

oidprovtool operation=modify ldap_host=OID_HOST ldap_port=OID_PORT 
ldap_user_dn='cn=orcladmin'ldap_user_password=ORCLADMIN_PASSWORD 
application_type=EMAIL 
application_dn='cn=EmailServerContainer,cn=Products,cn=OracleContext' 
application_name=EMAIL 
event_subscription='USER:ANY:MODIFY(mail,dn,orcluserApplnProvStatus;email)' 
event_subscription='USER:ANY:ADD (mail,dn,orclguid,cn,sn)' 
event_subscription='USER:ANY:DELETE' interface_version=3.0

Where:


OID_HOST is the infrastructure Oracle Internet Directory host name
OID_PORT is the infrastructure Oracle Internet Directory port number
ORCLADMIN_PASSWORD is the password for cn=orcladmin

Note:

Ensure that mail,dn,orclguid attributes are always included in the list of subscribed attributes. Otherwise, e-mail provisioning will not work as expected.

To compile and load the policy jar file, follow these instructions on an Applications Tier $ORACLE_HOME. In the case of multiple Applications Tiers, these steps must be performed on the Applications Tier that contains the latest Oracle Mail provisioning patches.

  1. To compile EmailCustomPolicyPlugin.java, the CLASSPATH must include the following jar files:


    $ORACLE_HOME/jlib/esprovisioning.jar
    $ORACLE_HOME/jlib/ldapjclnt10.jar
  2. Compile the policy plugin.

    $ORACLE_HOME/jdk/bin/javac
    oracle/mail/provisioning/policy/EmailCustomPolicyPlugin.java
    
    
  3. Create the policy plugin jar file.

    $ORACLE_HOME/jdk/bin/jar cvf
    $ORACLE_HOME/oes/provisioning_policyplugin/policyplugin.jar
    oracle/mail/provisioning/policy/*.class
    
    
  4. Load the policy jar file into the provisioning framework.

    Substitute $ORACLE_HOME with the full path of the Applications Tier ORACLE_HOME and create an ldif file with following lines:

    dn: cn=Plugins, cn=EMAIL, cn=Applications, cn=Provisioning,cn=Directory
    Integration Platform,cn=Products,cn=OracleContext
    changetype: modify
    replace: orclODIPPluginExecData
    orclODIPPluginExecData: $ORACLE_HOME/jlib/esprovisioning.jar
    
    dn: cn=Plugins, cn=EMAIL, cn=Applications, cn=Provisioning,cn=Directory
    Integration Platform,cn=Products,cn=OracleContext
    changetype: modify
    add: orclODIPPluginExecData
    orclODIPPluginExecData: 
    $ORACLE_HOME/oes/provisioning_policyplugin/policyplugin.jar
    
    

    Assuming the ldif file is $ORACLE_HOME/oes/provisioning_policyplugin/loadpolicy.ldif, run the following command to upload the policy jar file into the provisioning framework:

    $ORACLE_HOME/bin/ldapmodify -b -v -Dcn=orcladmin -w orcladmin_password -h oid_host -p oid_port -f
    $ORACLE_HOME/oes/provisioning_policyplugin/loadpolicy.ldif