Loading client/client.cpp +19 −0 Changes for client/client.cpp: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -228,4 +228,23 @@ void authdb::client::Client::SessionInfo(class SessionData& sdat){ json_tokener*jtok=json_tokener_new(); jrequest=json_tokener_parse_ex(jtok,resp.data(),resp.size()); if(!jrequest){ throw authdb::AuthBackendError(json_tokener_error_desc(json_tokener_get_error(jtok))); } if(json_object_get_type(jrequest)!=json_type::json_type_array) throw(authdb::AuthBackendError("Invalid Api Commands")); int fcount = json_object_array_length(jrequest); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(jrequest,i), key, val) { if(strcmp(key,"sessioninfo")==0){ sdat._username= json_object_get_string(json_object_object_get(val,"username")); } } } json_object_put(jrequest); json_tokener_free(jtok); } src/session.h +6 −0 Changes for src/session.h: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ #pragma once namespace authdb { namespace client { class Client; }; class SessionData { public: bool isMemberOf(const uuid &gid) const; Loading Loading @@ -70,6 +75,7 @@ namespace authdb { SessionData *_next; friend class Session; friend class client::Client; }; class Session{ Loading Loading
client/client.cpp +19 −0 Changes for client/client.cpp: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -228,4 +228,23 @@ void authdb::client::Client::SessionInfo(class SessionData& sdat){ json_tokener*jtok=json_tokener_new(); jrequest=json_tokener_parse_ex(jtok,resp.data(),resp.size()); if(!jrequest){ throw authdb::AuthBackendError(json_tokener_error_desc(json_tokener_get_error(jtok))); } if(json_object_get_type(jrequest)!=json_type::json_type_array) throw(authdb::AuthBackendError("Invalid Api Commands")); int fcount = json_object_array_length(jrequest); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(jrequest,i), key, val) { if(strcmp(key,"sessioninfo")==0){ sdat._username= json_object_get_string(json_object_object_get(val,"username")); } } } json_object_put(jrequest); json_tokener_free(jtok); }
src/session.h +6 −0 Changes for src/session.h: 6 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -38,6 +38,11 @@ #pragma once namespace authdb { namespace client { class Client; }; class SessionData { public: bool isMemberOf(const uuid &gid) const; Loading Loading @@ -70,6 +75,7 @@ namespace authdb { SessionData *_next; friend class Session; friend class client::Client; }; class Session{ Loading