Saturday, November 28, 2020

Rule to get the Identity Attribute values and list of applications assigned to an Identity

Import and execute the below Rule to get the Identity details:

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">

<Rule created="1606561116525" id="4028de8175ff665c017609edaaed09f1" language="beanshell" modified="1606561116525" name="Get Identity Details">

  <Description>Get Identity Details</Description>

  <Source>


    import java.util.List;

    import java.util.Iterator;

    import sailpoint.object.*;

    

  Identity user = context.getObjectByName(Identity.class,"Richard.Jackson");

  System.out.println("Identity Info for Richard.Jackson");

  System.out.println("========================");

  System.out.println("User Name = " + user.getName());

  System.out.println("First Name = " + user.getFirstname());

  System.out.println("Last Name = " + user.getLastname());

  System.out.println("Full Name = " + user.getFullName());

  //user.getManger() returns the Identity object of manager

  System.out.println("Manager = " + user.getManager().getName());

  System.out.println("Email Address = " + user.getEmail());

  System.out.println("Status = " + user.getAttribute("status"));

  System.out.println("Location = " + user.getAttribute("location"));

  System.out.println("Region = " + user.getAttribute("region"));

  

  //Check if the user is a manger for other Identity

  System.out.println("\n\nIs the user Manager for any identity = " + user.getManagerStatus());


  System.out.println("\nListing of Accounts");

  System.out.println("========================");

  List Links= (List) user.getLinks();  //Links represent application accounts correlated to an identity

 if (null != Links) {

        Iterator linkIterator = Links.iterator();

        while (linkIterator.hasNext()) {  

            Link account = (Link) linkIterator.next();

            System.out.println("Application Name = " + account.getApplicationName() + ";  Account Name = " + account.getDisplayableName());

    log.debug("Application Name = " + account.getApplicationName() + ";  Account Name = " + account.getDisplayableName());

      }

}

  </Source>

</Rule>


Check the Logs for Results:


Comment below if you find this post helpful.

No comments:

Post a Comment

Form AllowedValues rule to filter Identities with Active Regular Active Directory accounts and identity is active and correlated

 The rule type is AllowedValues. import org.apache.log4j.Level ; import org.apache.log4j.Logger ; import sailpoint.object.Filter ; import sa...