Dear Fabio,
I hope you are doing well,
You should first get the user role with this code ("java"):
var roles = ServerUtilities.getServerUserInfo().getRoles();
var role = roles.next();
variable rules icludes roles of the user which is entered and then the id_groups of the user who is member of them, so if you want to get the id_groups of the groups you should do .next() again.
the you should create a JSONObject and define the whereclause and put in it:
JSONObject inputParams = new JSONObject(operationInput);
inputParams.put("where", "Here you should put your clause in SQL format");
operationInput = inputParams.toString();
if you want to filter specific layers of specific field you can use these codes,
inputParams.put("layers", "0");
inputParams.put("layerDefs", layerDefs);
Best regards.
Amir Sarrafzadeh Arasi