Loading src/api.cpp +32 −0 Changes for src/api.cpp: 32 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,6 +70,38 @@ namespace authdb { } } void existsGPO(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); if(!cmd) throw(AuthBackendError("Invalid Api Commands")); int fcount = json_object_array_length(cmd); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(cmd,i), key, val) { if(strcmp(key,"gpoexists")==0){ const char *id=json_object_get_string(val); json_object *respid=json_object_new_object(); json_object *value=json_object_new_object(); class Gpo gpo; int ret=-1; if(gpo.exits(_Backend,uuid(id),nullptr,ret)){ json_object_object_add(value,id,json_object_new_boolean(true)); }else{ json_object_object_add(value,id,json_object_new_boolean(false)); } json_object_object_add(respid,"gpoexists",value); json_object_array_add(response,respid); } } } } const SessionData *checkUser(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); Loading Loading
src/api.cpp +32 −0 Changes for src/api.cpp: 32 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,6 +70,38 @@ namespace authdb { } } void existsGPO(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); if(!cmd) throw(AuthBackendError("Invalid Api Commands")); int fcount = json_object_array_length(cmd); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(cmd,i), key, val) { if(strcmp(key,"gpoexists")==0){ const char *id=json_object_get_string(val); json_object *respid=json_object_new_object(); json_object *value=json_object_new_object(); class Gpo gpo; int ret=-1; if(gpo.exits(_Backend,uuid(id),nullptr,ret)){ json_object_object_add(value,id,json_object_new_boolean(true)); }else{ json_object_object_add(value,id,json_object_new_boolean(false)); } json_object_object_add(respid,"gpoexists",value); json_object_array_add(response,respid); } } } } const SessionData *checkUser(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); Loading