Filter Identities based on workgroups and capabilities

Hi All,

I am trying to get the list of identities that are inactive and has access to a workgroup or capability:

Filter f1 = Filter.eq(“status”,“T”);
Filter f2 = Filter.notnull(“Workgroups”);
Filter f3 = f1.and(f2);
QueryOptions qo = new QueryOptions();
qo.addFilter(f3);
List allWorkgrps = context.getObjects(Identity.class, qo);
return allWorkgrps;

This doesnt work… please help with what to add in the AND condition.

Thanks.

The default field for inactive user is “inactive” (boolean).

From your description your filter should be more like:

Filter f1 = Filter.eq("inactive", false);
Filter f2 = Filter.notnull("workgroups.name");
Filter f3 = Filter.notnull("capabilities.name");
Filter f4 = Filter.or(f2, f3);
Filter f = Filter.and(f1, f4);

You can print the filter as a string to figure out what’s going on. My example becomes:

f.toString() is: 
(inactive == false && (workgroups.name.notNull() || capabilities.name.notNull()))