We are having issues with removing a role from code. We cannot build a ProvisioningPlan that will do the Remove Role function from the GUI in the Manage Access panel.
Can I have some example code of removing a role assignment? Since we haven’t been able to remove the business role, the aggregation and refresh will add everything back.
Possible Solution
I need a method to either make a provisioning plan with the right arguments or some magical identity function that can remove a certain assigned role.
Trouble Code
Here is something that I have tried, but it gave a general error when I added the context.commitTransaction()
// I couldnt find a way to filter by application on the required role so I have to filter on the IT roles
Application app = context.getObjectByName(Application.class, oracleAppName);
List <Bundle> ITRoles = identity.getBundles(app);
List <Bundle> RequestableRoles = identity.getAssignedRoles();
//this was fun to figure out... I have to determine which required role to remove based on the IT required role that is assigned to it
for(Bundle ITrole : ITRoles)
{
String ITroleName = ITrole.getFullName();
for(Bundle RequestableRole : RequestableRoles)
{
String RequestableRoleName = RequestableRole.getFullName();
List <Bundle> RequiredITRoles = RequestableRole.getRequirements();
for(Bundle RequiredITRole : RequiredITRoles)
{
String RequiredITRoleName = RequiredITRole.getFullName();
if(RequiredITRoleName.equals(ITroleName))
{
identity.removeAssignedRole(RequestableRole);
}
}
}
}
context.saveObject(identity);
context.commitTransaction();
I used the removeAssignedRole() with context.saveObject(identity) and context.commitTransaction
However, in the next iteration, I get the following error:
while(linksIter.hasNext())
{
Link link = linksIter.next();
Identity identity = link.getIdentity();
// Do remove operation
removeRole(identity); // context.saveObject() is inside this function
}
Error output:
unknown error: null : at Line: 366 : in file: inline evaluation of: ``import org.apache.log4j.Logger; import org.apache.log4j.Level; import sailpoint. . . . '' : while ( linksIter .hasNext
It seems that my iterator becomes null when I do the commit transaction. I am having to iterate through many identities before I can close the rule. How do I avoid this error?
@pravin_ranjan you are very good with searching this forum. What is your strategy? I use google, but that obviously hasn’t gotten the same results you have. Thanks!