Monday, October 16, 2023

Disable BlackListUsers in ForgeRock

 //ForgeRock IDM ->Configure ->Mappings ->Behaviour ->Situational Event Script

Check Policies under behavior like absent - create, Found -update

//OnCreate Script to Disable the BlackListUsers based on cisNo matching to blackListUser. So that they cannot login into the system

var cisNo=target.blcCisNo;

if(cisNo){

var userQuery={"_queryFilter": "cisNo eq "+cisNo};

}

try{

var matchingUsers=openidm.query("managed/user", userQuery);

if(matchingUsers.result.length > 0)){

for(var i=0; i< matchingUsers.result.length; i++){

var userId=matchingUsers.result[i]._id;

var user =openidm.read("managed/user/"+userid);

var result=openidm.patch("managed/user/"+userid", null ,[{"operation": "replace","field":"/disabledStatus","value":"1"}]);

}

catch(e){

logger.error("error updating user account " +e);

}

}

}

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...