How to bulk delete roles

Which IIQ version are you inquiring about?

[8.4]

I am looking for a way to bulk delete roles entirely from IIQ. Not from users but actually completely delete them from IIQ. I am looking to delete thousands of roles from our environment. Anyone know a bulk way to accomplish this within IIQ?

Thanks!

You can use console .

delete Bundle < bundleID/BundleName>

1 Like

if you want to delete in bulk create a file containing below lines and then source that to iiq console.

delete Bundle < bundleID1/BundleName1>
delete Bundle < bundleID2/BundleName2>
delete Bundle < bundleID3/BundleName3>

1 Like

James, Welcome to the developer site! One challenge for this is that the hierarchy can get in the way, where you might encounter an issue when a bundle that has a required role would be deleted before the required role, or inheritance can get in the way.

I have written a task in my Mercury Cyber Documenter plugin that can print out a list of roles, which can be then turned into a file that can be sent to the console. LMK if you would like to try it out, we can connect.

The process looks like this: Run the Role Analysis task in bottomup mode. If you want to delete everything in a specific folder (Org role) then you can specify that as the starting point. It produces a file of bundle names. You can then take that file and with NPP you can prepend each line in the file with delete Bundle " and then postpend with "
Once that modified file is saved, you can copy it to the console’s bin folder and execute the console, and enter source filename

1 Like

Thanks for that! Additionally is there a way to bulk disable the roles that you know of?

I don’t think you can do via console , but for sure you can use the write a custom rule do disable bulk roles and then you can trigger that rule via task definition

1 Like

One way I can think of, export roles using IIQ console and add (you can use notepad++ find and replace) disabled=“true”
to <Bundle created=“1650268921424”

and import back. I would do a quick POC in lower environment to capture the process and try later in PROD. Please also keep a back up in the event you need to restore.

1 Like

Hi @jfree05,

To disable roles in bulk, you can create a Run Rule task and associate the rule with it. Please refer the rule for reference.

QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq("type","business"));
qo.addFilter(Filter.eq("disabled", false));
List bundles = context.getObjects(Bundle.class,qo);

for(Bundle bundle : bundles){

bundle.setDisabled(true);

context.saveObject(bundle);

}

context.commitTransaction();
1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.