Commit 9b64150d authored by jan.koester's avatar jan.koester
Browse files

test

parent e59f314d
Loading
Loading
Loading
Loading
Loading
+5 −36
Changes for src/admin.cpp: 5 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -180,7 +180,6 @@ namespace authdb {
        void apiGetUser(libhttppp::HttpRequest &curreq, const char *cdid, const char *cuid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("getUser: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid uid;
            uid.parse(cuid);
@@ -213,7 +212,6 @@ namespace authdb {
        void apiCreateUser(libhttppp::HttpRequest &curreq, const char *cdid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("createUser: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            libhttppp::HttpForm curform;
            curform.parse(curreq);
@@ -359,7 +357,6 @@ namespace authdb {
        void apiRemoveUser(libhttppp::HttpRequest &curreq, const char *cdid, const char *cuid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("removeUser: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            User user;
            uuid::uuid uuid;
@@ -376,7 +373,6 @@ namespace authdb {
        void apiEditUser(libhttppp::HttpRequest &curreq, const char *cdid, const char *cuid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("editUser: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid uid;
            uid.parse(cuid);
@@ -710,7 +706,6 @@ namespace authdb {
        void apiCreateDomain(libhttppp::HttpRequest &curreq, const SessionData *sdat) {
            if (!isSuperAdmin(sdat))
                throw AuthBackendError("createDomain: nur SuperAdmins von admin.local erlaubt!");
            AuthBackend::Guard guard(_AdminBackend);
            std::vector<char> body;
            libhttppp::HttpForm curform;
            curform.parse(curreq);
@@ -854,7 +849,6 @@ namespace authdb {
                }
            }

            AuthBackend::Guard guard(_AdminBackend);
            Domain domain;
            domain.remove(_AdminBackend, uuid);

@@ -899,7 +893,6 @@ namespace authdb {
        void apiGetGroup(libhttppp::HttpRequest &curreq, const char *cdid, const char *cgid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("getGroup: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid gid(cgid);
            json_object *jobj = json_object_new_object();
@@ -947,7 +940,6 @@ namespace authdb {
        void apiCreateGroup(libhttppp::HttpRequest &curreq, const char *cdid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("createGroup: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            std::string reqbody = getRequestBody(curreq);
            json_object *jreq = json_tokener_parse(reqbody.c_str());
@@ -985,7 +977,6 @@ namespace authdb {
        void apiRemoveGroup(libhttppp::HttpRequest &curreq, const char *cdid, const char *cgid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("removeGroup: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            Group group;
            uuid::uuid uuid;
@@ -1002,7 +993,6 @@ namespace authdb {
        void apiEditGroup(libhttppp::HttpRequest &curreq, const char *cdid, const char *cgid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("editGroup: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid gid(cgid);

@@ -1025,12 +1015,8 @@ namespace authdb {
            }

            Group grp;
            try {
                grp.remove(*backend, gid.value);
            } catch (...) {
                std::cerr << "no entry with this uuid exists!" << std::endl;
            }
            grp.create(*backend, &editrec);
            size_t pos = sizeof(AuthHeader);
            grp.edit(*backend, editrec, pos);

            json_object_put(jreq);

@@ -1089,7 +1075,6 @@ namespace authdb {

            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("reloadSession: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            AuthSession->relSession(*backend, sid);

@@ -1140,7 +1125,6 @@ namespace authdb {
        void apiGetGpo(libhttppp::HttpRequest &curreq, const char *cdid, const char *cgpid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("getGpo: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid gpid;
            gpid.parse(cgpid);
@@ -1199,7 +1183,6 @@ namespace authdb {
        void apiCreateGpo(libhttppp::HttpRequest &curreq, const char *cdid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("createGpo: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            std::string reqbody = getRequestBody(curreq);
            json_object *jreq = json_tokener_parse(reqbody.c_str());
@@ -1248,7 +1231,6 @@ namespace authdb {
        void apiRemoveGpo(libhttppp::HttpRequest &curreq, const char *cdid, const char *cgpid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("removeGpo: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid gpid;
            gpid.parse(cgpid);
@@ -1266,7 +1248,6 @@ namespace authdb {
        void apiEditGpo(libhttppp::HttpRequest &curreq, const char *cdid, const char *cgpid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("editGpo: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid gpid;
            gpid.parse(cgpid);
@@ -1288,8 +1269,6 @@ namespace authdb {
            json_object *jdefault = json_object_object_get(jreq, "gpodefaultvalue");
            json_object *jgroups = json_object_object_get(jreq, "gpoingroup");

            gpo.remove(*backend, gpid);

            if (jdesc) gpodat.setDesc(json_object_get_string(jdesc));
            if (jdefault) gpodat.setGpoValue(json_object_get_boolean(jdefault));

@@ -1301,7 +1280,7 @@ namespace authdb {
                }
            }
            gpodat.setAllowed(allow);
            gpo.create(*backend, &gpodat);
            gpo.edit(*backend, gpodat);

            json_object_put(jreq);

@@ -1356,7 +1335,6 @@ namespace authdb {
        void apiGetService(libhttppp::HttpRequest &curreq, const char *cdid, const char *csid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("getService: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid sid;
            if (sid.parse(csid) != 0)
@@ -1387,7 +1365,6 @@ namespace authdb {
        void apiCreateService(libhttppp::HttpRequest &curreq, const char *cdid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("createService: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            std::string reqbody = getRequestBody(curreq);
            json_object *jreq = json_tokener_parse(reqbody.c_str());
@@ -1464,7 +1441,6 @@ namespace authdb {
        void apiRemoveService(libhttppp::HttpRequest &curreq, const char *cdid, const char *csid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("removeService: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid svid;
            if (svid.parse(csid) != 0)
@@ -1482,7 +1458,6 @@ namespace authdb {
        void apiEditService(libhttppp::HttpRequest &curreq, const char *cdid, const char *csid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("editService: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid sid;
            if (sid.parse(csid) != 0)
@@ -1552,8 +1527,7 @@ namespace authdb {
                }
            }

            svcmgr.remove(*backend, sid);
            svcmgr.create(*backend, &sdat);
            svcmgr.edit(*backend, sdat);

            json_object_put(jreq);

@@ -1598,7 +1572,6 @@ namespace authdb {
        void apiGetClient(libhttppp::HttpRequest &curreq, const char *cdid, const char *cclid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("getClient: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid clid;
            if (clid.parse(cclid) != 0)
@@ -1620,7 +1593,6 @@ namespace authdb {
        void apiCreateClient(libhttppp::HttpRequest &curreq, const char *cdid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("createClient: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            std::string reqbody = getRequestBody(curreq);
            json_object *jreq = json_tokener_parse(reqbody.c_str());
@@ -1671,7 +1643,6 @@ namespace authdb {
        void apiRemoveClient(libhttppp::HttpRequest &curreq, const char *cdid, const char *cclid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("removeClient: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid cldid;
            if (cldid.parse(cclid) != 0)
@@ -1689,7 +1660,6 @@ namespace authdb {
        void apiEditClient(libhttppp::HttpRequest &curreq, const char *cdid, const char *cclid) {
            AuthBackend *backend = getDomain(cdid);
            if (!backend) throw AuthBackendError("editClient: could not resolve domain!");
            AuthBackend::Guard guard(*backend);

            uuid::uuid clid;
            if (clid.parse(cclid) != 0)
@@ -1731,8 +1701,7 @@ namespace authdb {
                }
            }

            clt.remove(*backend, clid);
            clt.create(*backend, &cldat);
            clt.edit(*backend, cldat);

            json_object_put(jreq);

+4 −0
Changes for src/client.cpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -160,6 +160,10 @@ void authdb::Client::remove(AuthBackend& backend, const uuid::uuid &clid){
    backend.delRecord(clid.value,DataType::ClientData);
}

void authdb::Client::edit(AuthBackend &backend, class ClientData &dat){
    backend.editRecord(dat, DataType::ClientData);
}

authdb::AuthBackend * authdb::ClientConnections::getBackend(){
    return &_backend;
}
+1 −0
Changes for src/client.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ namespace authdb {
        Client(Client &&src);
        ~Client();
        void create(AuthBackend &backend,class ClientData *data);
        void edit(AuthBackend &backend, class ClientData &dat);
        void remove(AuthBackend &backend,const uuid::uuid &clid);
        bool exits(AuthBackend&  backend,const uuid::uuid &clid, const char* name,int &ret);
        void info(AuthBackend   &backend,class ClientData &dat,size_t &pos);
+4 −0
Changes for src/gpo.cpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -167,6 +167,10 @@ void authdb::Gpo::remove(AuthBackend &backend,const uuid::uuid &gpid){
    backend.delRecord(gpid,DataType::PolicyData);
}

void authdb::Gpo::edit(AuthBackend &backend, class GpoData &dat){
    backend.editRecord(dat, DataType::PolicyData);
}

void authdb::Gpo::info(AuthBackend &backend, class GpoData& dat, size_t &pos){
    if(uuid::uuid(dat.Data.ruid).empty())
        throw AuthBackendError("gpo info gpoid required!");
+1 −0
Changes for src/gpo.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ namespace authdb {
    public:
        bool exists(AuthBackend &backend,const uuid::uuid &gpid,const char *name, int &ret);
        void create(AuthBackend& backend, class GpoData* dat);
        void edit(AuthBackend &backend, class GpoData &dat);
        void remove(AuthBackend &backend,const uuid::uuid &gpid);
        void info(AuthBackend &backend, class GpoData& dat, size_t &pos);
        void list(AuthBackend &backend,std::vector<uuid::uuid> &uuids);
Loading