Wednesday, February 16, 2022

How to create AD group using beanshell?

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

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

<Rule created="1645024143138" id="402880e97e7e66fa017f0314672202d8" language="beanshell" modified="1645024242981" name="Create AD Group">

  <Description>

Create AD Group.

  </Description>

  <Signature>

    <Inputs>

      <Argument name="log">

        <Description>

          The log object is associated with the SailPointContext.

        </Description>

      </Argument>

      <Argument name="context">

        <Description>

          A sailpoint.api.SailPointContext object that can be used to query the database if necessary.

        </Description>

      </Argument>

    </Inputs>

  </Signature>

  <Source>

import java.util.ArrayList;

import java.util.List;

import sailpoint.api.Provisioner;

import sailpoint.object.ProvisioningPlan;

import sailpoint.object.ProvisioningPlan.ObjectRequest;


ObjectRequest objectRequest = new ObjectRequest();

objectRequest.setOp(ProvisioningPlan.ObjectOperation.Create);

objectRequest.add(new ProvisioningPlan.AttributeRequest("GroupType", ProvisioningPlan.Operation.Set, "Security"));

objectRequest.add(new ProvisioningPlan.AttributeRequest("SamAccountName", ProvisioningPlan.Operation.Set, "Test"));

objectRequest.setApplication("Active Directory");

objectRequest.setNativeIdentity("CN=Test,ou=Groups,dc=mightypedia,dc=com");

objectRequest.setType("group");


List objReqList = new ArrayList();

objReqList.add(objectRequest);


ProvisioningPlan plan = new ProvisioningPlan();

plan.setObjectRequests(objReqList);


Provisioner provisioner  = new Provisioner(context);

provisioner.execute(plan);

  return plan;

  </Source>

</Rule>


No comments:

Post a Comment

Fetch Members from Workgroup

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