Loading api/addcon.json 0 → 100644 +10 −0 Changes for api/addcon.json: 10 added lines, 0 removed lines. Original line number Diff line number Diff line { "commands" : [ { "addconnection" : { "username" : "$username", "password" : "$userpassword" } } ] } src/api.cpp +26 −5 Changes for src/api.cpp: 26 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ namespace authdb { public: void checkGPO(json_object *request,json_object *response){ // std::lock_guard<std::mutex> lock(AuthSessionLock); std::lock_guard<std::mutex> lock(AuthSessionLock); json_object *cmd=json_object_object_get(request,"commands"); if(!cmd) throw(AuthBackendError("Invalid Api Commands")); Loading Loading @@ -277,6 +277,25 @@ namespace authdb { return nullptr; } void Connection(json_object *request,json_object *response){ std::lock_guard<std::mutex> lock(AuthClientLock); 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,"addconnection")==0){ }else if(strcmp(key,"remconnection")==0){ } } } } Api(AuthBackend &admin,class uuid did, libhttppp::HttpRequest* curreq, const int tid, ULONG_PTR args) : _Backend(admin), _Did(did){ _SessionData=nullptr; Loading Loading @@ -311,6 +330,12 @@ namespace authdb { const ClientConnections *curcon=nullptr; // const SessionData *sessiondat=nullptr; if(! (_SessionData=checkUser(jrequest,jresponse)) ){ _SessionData=userLogin(jrequest,jresponse); } Connection(jrequest,jresponse); if(! (curcon=checkConnection(jrequest,jresponse)) ){ if(! (curcon=ClientLogin(jrequest,jresponse)) ){ const char *ret=json_object_to_json_string(jresponse); Loading @@ -323,10 +348,6 @@ namespace authdb { } } if(! (_SessionData=checkUser(jrequest,jresponse)) ){ _SessionData=userLogin(jrequest,jresponse); } if(_SessionData){ checkGPO(jrequest,jresponse); } Loading Loading
api/addcon.json 0 → 100644 +10 −0 Changes for api/addcon.json: 10 added lines, 0 removed lines. Original line number Diff line number Diff line { "commands" : [ { "addconnection" : { "username" : "$username", "password" : "$userpassword" } } ] }
src/api.cpp +26 −5 Changes for src/api.cpp: 26 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ namespace authdb { public: void checkGPO(json_object *request,json_object *response){ // std::lock_guard<std::mutex> lock(AuthSessionLock); std::lock_guard<std::mutex> lock(AuthSessionLock); json_object *cmd=json_object_object_get(request,"commands"); if(!cmd) throw(AuthBackendError("Invalid Api Commands")); Loading Loading @@ -277,6 +277,25 @@ namespace authdb { return nullptr; } void Connection(json_object *request,json_object *response){ std::lock_guard<std::mutex> lock(AuthClientLock); 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,"addconnection")==0){ }else if(strcmp(key,"remconnection")==0){ } } } } Api(AuthBackend &admin,class uuid did, libhttppp::HttpRequest* curreq, const int tid, ULONG_PTR args) : _Backend(admin), _Did(did){ _SessionData=nullptr; Loading Loading @@ -311,6 +330,12 @@ namespace authdb { const ClientConnections *curcon=nullptr; // const SessionData *sessiondat=nullptr; if(! (_SessionData=checkUser(jrequest,jresponse)) ){ _SessionData=userLogin(jrequest,jresponse); } Connection(jrequest,jresponse); if(! (curcon=checkConnection(jrequest,jresponse)) ){ if(! (curcon=ClientLogin(jrequest,jresponse)) ){ const char *ret=json_object_to_json_string(jresponse); Loading @@ -323,10 +348,6 @@ namespace authdb { } } if(! (_SessionData=checkUser(jrequest,jresponse)) ){ _SessionData=userLogin(jrequest,jresponse); } if(_SessionData){ checkGPO(jrequest,jresponse); } Loading