Showing posts with label JAVA. Show all posts
Showing posts with label JAVA. Show all posts

Saturday, July 11, 2020

Sailpoint IdenityIQ Application Health Checkup Custom Report


Custom Report to test the Connectivity of the Application , Basically this report can be used to check the Health of the Different Application in Sailpoint Identity IQ

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<TaskDefinition executor="sailpoint.reporting.LiveReportExecutor" name="VISHAL Target Applications Connection Check" progressMode="Percentage" resultAction="Rename" subType="Configured Resource Reports" template="true" type="LiveReport">
  <Attributes>
    <Map>
      <entry key="TaskDefinition.runLengthAverage"/>
      <entry key="TaskDefinition.runLengthTotal"/>
      <entry key="TaskDefinition.runs"/>
      <entry key="report">
        <value>
          <LiveReport title="Applications Detail Report">
            <DataSource objectType="Application" type="Filter">
              <QueryParameters>
                <Parameter argument="applications" property="id"/>
                <Parameter argument="owners" property="owner.id"/>
              </QueryParameters>
            </DataSource>
            <ReportForm>
              <Reference class="sailpoint.object.Form" name="Applications Detail Report Form"/>
            </ReportForm>
            <Columns>
              <ReportColumnConfig field="application" header="rept_app_grid_col_app" property="name" sortable="true" width="110"/>
              <ReportColumnConfig field="connectionStatus" header="Target System Connection Status" property="id" sortable="true" width="110">
                <RenderScript>
                  <Source>
				  
import sailpoint.connector.Connector;  
import sailpoint.connector.ConnectorFactory; 
import sailpoint.connector.*; 
import sailpoint.object.Application;  
import sailpoint.object.TaskItemDefinition;  
import sailpoint.object.TaskItemDefinition.ProgressMode;  
import sailpoint.tools.GeneralException;  
import sailpoint.tools.Message;  
import sailpoint.tools.Util;  
import sailpoint.api.SailPointContext;
import sailpoint.object.*;
import java.lang.reflect.Constructor;
import java.util.*;

  
try {  

        Application app = (Application) context.getObjectById(Application.class, value);
        if (app != null) {   
                try {  
                    
                    Connector connector = ConnectorFactory.getConnector(app, null);
					connector.testConfiguration();
                    return "Test Connection Successful.";
                } catch (Exception e) { 
                    return e.getMessage();
                        log.error(e);  
                }  
        }  
} catch (Exception e) {  

        log.error(e);  
        throw(e);  
}  
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
            </Columns>
          </LiveReport>
        </value>
      </entry>
    </Map>
  </Attributes>
  <Description>Displays configured applications Test Connection</Description>
  <RequiredRights>
    <Reference class="sailpoint.object.SPRight" name="FullAccessApplicationReport"/>
  </RequiredRights>
  <Signature>
    <Inputs>
      <Argument multi="true" name="applications" type="Application">
        <Description>rept_input_app_report_apps</Description>
      </Argument>
      <Argument filterString="capabilitiesString != &quot;null&quot;" multi="true" name="owners" type="Identity">
        <Description>rept_input_app_report_owners</Description>
      </Argument>
    </Inputs>
  </Signature>
</TaskDefinition>



Thursday, February 13, 2020

Sailpoint IIQ List of Role Mapped for Entitlement API DB Query


SQL to get the list of Business IT Role in Sailpoint IIQ which is mapped for the particular Entitlement

select bun.id,bun.type,bun.name,bun.display_name,bun.requestable,
prof_cons.ELT
from spt_bundle bun,spt_profile profile,spt_profile_constraints prof_cons,spt_bundle_requirements bun_req
where bun.id=profile.bundle_id and
profile.id=prof_cons.profile and
bun_req.child = bun.id
and prof_cons.ELT like '%%'


JAVA API to get the list of Business IT Role in Sailpoint IIQ which is mapped for the particular Entitlement

String appName="Active Directory";
String entitlementName = "CN=blah, etc, etc";
QueryOptions profileQo = new QueryOptions();
profileQo.addFilter(Filter.eq("application.name", appName));

List profiles = context.getObjects(Profile.class, profileQo);
if (profiles != null) {
    for (Object profileObj : profiles) {
        Profile p = (Profile) profileObj;
        List constraints = p.getConstraints();
        List filterList = null;
        if (constraints != null) {
            for (Object filter : constraints) {
                filterList = new ArrayList();
                if (filter instanceof sailpoint.object.Filter.LeafFilter) {
                    sailpoint.object.Filter.LeafFilter f = (sailpoint.object.Filter.LeafFilter) filter;
                    //Filter can have multiple values 
                    Object value = f.getValue();
                    if (value instanceof ArrayList) {
                        ArrayList entitlements = new ArrayList();
                        entitlements = (ArrayList) value;
                        for (Object obj : entitlements) {
                            if (obj.toString().equals(entitlementName)) {
                                Bundle bun = p.getBundle();
                                // Do something with the Bundle here
                            }
                        }
                    }
                }
            }
        }
    }
}