Thursday, 22 January 2015

Set delegates to manager in OIM 11g R2 using API

This code snippet set up a proxy/delegate to the user to act on specified time period.


private void addDelegateToManager(String managerLogin,String delegateLogin,String strFrmdate,String strEndDate,String strDateFormat) {

   
  UserManager userMgr = null;
  try
  {
   userMgr = Platform.getService(UserManager.class);
   ContextManager.pushContext("Admin Update " + managerLogin,ContextTypes.ADMIN, "Add proxy");
   String proxyKey = getProxyKey(delegateLogin);
   String managerKey = getProxyKey(managerLogin);
   Date frmDate = convertStringtoDate(strFrmdate,strDateFormat);
   Date endDate = convertStringtoDate(strEndDate,strDateFormat);
   String proxyId = "0";
   if((managerKey != null && managerKey.length()>0) && (proxyKey != null && proxyKey.length()>0) && (frmDate != null && endDate != null)){
    proxyId = userMgr.addProxyForUser(managerKey, proxyKey,frmDate,endDate,false);
    
   }else
   {
   //failed
   }
  }catch ()

No comments:

Post a Comment