Monday, July 18, 2022

How to check user exist in specific group or not?

 import sailpoint.object.Filter;

 import sailpoint.object.Identity;

 import sailpoint.object.IdentityEntitlement;

 import sailpoint.object.QueryOptions;

 import sailpoint.tools.GeneralException;


public boolean checkUserENT(String userID, String entValue, String appName) throws GeneralException{

boolean addEntExist = false;

QueryOptions qo = new QueryOptions();

Filter filter = Filter.and(Filter.eq("identity.id", id), Filter.eq("value",entValue), Filter.eq("application.name", appName));

qo.addFilter(filter);


int countObjects = context.countObjects(IdentityEntitlement.class, qo);

if(countObjects  > 0){

addEntExist = true;

}

String appName = "Active Directory";

String entValue = "CN="IdentityIQ, OU=Groups, DC=mightypedia,DC=com";

String user = ""Mary.Johnson;


String userID = context.getObjectByName(Identity.class, user).getId();

boolean checkENT = checkUserENT(userID , entValue ,appName );

return checkENT ;

}

No comments:

Post a Comment

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...