Sunday, April 25, 2021

Rule - In Finance application, list out employees belongs to 'PAYROLL' department with privileged, inactive and service as 'FALSE'

 //In Finance application,list out employees belongs to 'PAYROLL' department with privileged 
//,inactive and service as 'FALSE'.Output should display identity details like first Name,LastName and email.

import sailpoint.object.QueryOptions;
import sailpoint.object.Filter;
import sailpoint.object.Identity;
import sailpoint.object.Link;
import sailpoint.object.Attributes;
 List linksList = new ArrayList();
 ArrayList accountInfo = new ArrayList();
 String privileged = null;
 String service = null;
 
 QueryOptions qo = new QueryOptions();
 Filter linkFilter = Filter.eq("links.application.name","Financials");
 Filter depFilter = Filter.eq("department","Accounting");
 qo.addFilter(Filter.and(linkFilter, depFilter));
 List identityList = context.getObjects(Identity.class, qo); 
 
 if(identityList != null){
  for(Identity identity : identityList){
 
  List links = identity.getLinks();
  if(links != null){
  for(Link link : links){
  String applicationName = link.getApplicationName();
 
  if(applicationName!= null && (applicationName.equalsIgnoreCase("Financials"))){
  Attributes attributes = link.getAttributes();
  if (attributes != null){
  if(attributes.getString("app2_privileged") != null && 
  (attributes.getString("app2_privileged").equalsIgnoreCase("false")) &&
  (attributes.getString("app2_service") != null) && 
  (attributes.getString("app2_service").equalsIgnoreCase("false")) ){
   
  privileged = attributes.getString("app2_privileged");
  service = attributes.getString("app2_service");
 
  accountInfo.add(identity.getName() + " :: " + identity.getFirstname() + " :: " + 
  " :: " + applicationName + " :: " + privileged + " :: "+ service);
  }
  }
  }
 
  }
  }
 
  log.debug( accountInfo);
 }

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...