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