Easiest way to generate it is to click through population of identities you need in Advanced Analytics, then save it as population and you can always refer to it in your Beanshell rules.
Here is a revised version of your query with some of these suggestions:
String applicationName = “appAD”; // Make sure this is set correctly to your application’s name
String entitlementValue = “XY”;
String entitlementName = “memberOf”;
// Constructing the filter for querying entitlements
Filter filterEntitlement = Filter.and(
Filter.eq(“application.name”, applicationName),
Filter.eq(“name”, entitlementName),
Filter.eq(“aggregationState”, AggregationState.Connected),
Filter.eq(“value”, entitlementValue)
);
// Using the correct attribute name for the collection condition
Filter filter = Filter.collectionCondition(“entitlements”, filterEntitlement);
// Preparing the query options
QueryOptions qo = new QueryOptions();
qo.addFilter(filter);
// Execute the query
List identities = context.getObjects(Identity.class, qo);
// Check the size of the result to confirm if identities are found
if (identities.isEmpty()) {
System.out.println(“No identities found with the specified entitlement.”);
} else {
for (Identity identity : identities) {
System.out.println("Found identity: " + identity.getName());
}
}
Hello guys
Thank you all based your answers I did my query/rule.
I already have the users and the information of the users account (appAD)
But but based on this, How can I Change the users OU .
Basically all users catch in this rule I want to move them to OU = Users so the distinguished names will be something like Cn = YYY, OU = Users insted of Cn = YYY, OU = OLD_OU
@RIsidoro
If you have users AD DN already please use the below code in the rule and perform the movement of accounts
Iterate through your AD link objects and perform below
for(Link activeDirectoryLink: adLinks){
ProvisioningPlan plan = new ProvisioningPlan();
AccountRequest acct = new AccountRequest();
acct.setOperation(ProvisioningPlan.AccountRequest.Operation.Modify);
acct.setApplication("<give your AD App Name>");
acct.setNativeIdentity(activeDirectoryLink.getNativeIdentity());
acct.add(new AttributeRequest("AC_NewParent",ProvisioningPlan.Operation.Set, "<Give your New Comple OU"));
plan.add(acct);
try {
Provisioner provisioner = new Provisioner(context);
ProvisioningProject project = provisioner.compile(plan);
provisioner.execute(project);
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}