//Conversion of role from one type to another type & making the roles into inheritance::: -
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="Convert-Role">
<Source>
import sailpoint.object.Bundle;
import sailpoint.object.Filter;
import sailpoint.object.Identity;
import sailpoint.object.QueryOptions;
import sailpoint.tools.Util;
import sailpoint.api.IncrementalObjectIterator;
List listofRoles = new ArrayList();
Bundle container = context.getObjectByName(Bundle.class,"Legacy-Birthright-Roles");
listofRoles.add(container);
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq("type", "IT"));
//qo.addFilter(Filter.eq("name", "Contractor_BusinessRole"));
IncrementalObjectIterator iterator = new IncrementalObjectIterator(context, Bundle.class,qo);
while (iterator != null && iterator.hasNext()) {
Bundle bundle = iterator.next();
// bundle.setType("birthright");
bundle.setInheritance(listofRoles);
context.saveObject(bundle);
context.commitTransaction();
context.decache();
}
Util.flushIterator(iterator);
</Source>
</Rule>
No comments:
Post a Comment