Saturday, May 22, 2021

How to build a Provisioning plan from Snapshot?

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import sailpoint.object.Filter;

import sailpoint.object.Identity;

import sailpoint.object.IdentitySnapshot;

import sailpoint.object.LinkSnapshot;

import sailpoint.object.ProvisioningPlan;

import sailpoint.object.ProvisioningPlan.AccountRequest;

import sailpoint.object.QueryOptions;

import sailpoint.tools.GeneralException;


 public List<LinkSnapshot> getIdSnapshot(String identityName) throws GeneralException {

log.debug("Enter into the method : getIdSnapshot");

boolean checkSnapshot = false;

List<LinkSnapshot> linkSnap = new ArrayList<LinkSnapshot>();


QueryOptions qop = new QueryOptions();

qop.addFilter(Filter.eq("identityName", identityName));

qop.setOrderBy("created");

qop.setOrderAscending(false);


Iterator<IdentitySnapshot> it = context.search(IdentitySnapshot.class, qop);

checkSnapshot = it.hasNext();

if (checkSnapshot) {

IdentitySnapshot eachIdentitySnapshot = (IdentitySnapshot) it.next();

linkSnap = eachIdentitySnapshot.getLinks();

}

log.debug("Exiting from the method : getIdSnapshot");

return linkSnap;

}


public ProvisioningPlan buildPlanFromSnapshot(String identityName) throws GeneralException {

log.debug("Enter into the method : buildFromSnapshot");

ProvisioningPlan plan = new ProvisioningPlan();

Identity identity = context.getObjectByName(Identity.class, identityName);

if (plan != null) {

plan.setIdentity(identity);

}

List<LinkSnapshot> linkSnap = new ArrayList<LinkSnapshot>();

linkSnap = getIdSnapshot(identityName);


for (LinkSnapshot ls : linkSnap) {

if (ls.getAttributes().get("IIQDisabled") == null

|| ls.getAttributes().get("IIQDisabled").toString().equals("false")) {

AccountRequest accountRequest = new AccountRequest();

accountRequest.setApplication(ls.getApplicationName());

accountRequest.setInstance(ls.getInstance());

accountRequest.setNativeIdentity(ls.getNativeIdentity());

accountRequest.setOperation(AccountRequest.Operation.Create);

plan.add(accountRequest);

}

}

log.debug("Link plan : " + plan.toXml());

log.debug("Exiting from the method : buildPlanFromSnapshot");

return plan;

}

Saturday, May 15, 2021

LCM Provisioning

 Reference: Lifecycle Manager Workflows - Compass (sailpoint.com)

Workflow: LCM Provisioning

# Identity Request Initialize

                Identity Request Violation Review

                Do Provisioning Forms

        Manage Ticket

                Provision with retries

# Provisioning Approval Subprocess       

# Approve and Provision Subprocess

                Provisioning Approval Subprocess

                Manage Ticket

                        Provision with retries

                Identity Request Provision

                        Do Provisioning Forms

                        Provision with retries

                        Check Status of queued items

                Manage Ticket

                        Provision with retries

# Identity Request Notify

# Identity Request Finalize

                Manage Ticket

                        Provision with retries

Saturday, May 1, 2021

How to remove Workgroups for the user?

import java.util.ArrayList;

import java.util.List;

import sailpoint.object.Identity;

import sailpoint.api.SailPointContext; 

import sailpoint.tools.GeneralException;


public void removeWorkGroupsAssignment(String name) throws GeneralException{

String methodName = "removeWprkGroupAssignment";

log.debug("Entering into the method : "+methodName);


Identity identityObj = context.getObject(Identity.class, name);

List<Identity idWorkGroups = new ArrayList<Identity>();

idWorkGroups = identityObj.getWorkgroups();


for(Identity workGoup : idWorkGroups){

identityObj.remove(workGoup);

context.saveObject(identityObj);

context.commitTansaction();

}

log.debug("Exiting from the method : "+methodName);

}

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...