From 1b3d94b6dba8ec9aabb1c42a490c46dbb8bae041 Mon Sep 17 00:00:00 2001 From: Jan Koester Date: Thu, 6 Mar 2025 06:18:03 +0100 Subject: [PATCH] it goes on --- src/admin.cpp | 59 ++++++++++++++++++++++++++++++++++++++------------- src/gpo.cpp | 2 +- src/gpo.h | 5 ++--- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/admin.cpp b/src/admin.cpp index c93ca16..3f0fb8e 100644 --- a/src/admin.cpp +++ b/src/admin.cpp @@ -1546,6 +1546,25 @@ namespace authdb { } }; if(gpodat){ + GpoData::Allow allow; + allow.count=0; + + for (libhttppp::HttpForm::MultipartForm::Data* curformdat = GPOForm.MultipartFormData.getFormData(); + curformdat; curformdat = curformdat->nextData()) { + for(libhttppp::HttpForm::MultipartForm::Data::ContentDisposition *curdispo=curformdat->getDisposition(); + curdispo; curdispo=curdispo->nextContentDisposition() + ){ + if( strcmp(curdispo->getKey(),"name")==0 && strcmp(curdispo->getValue(),"gpoingroup")==0 ){ + ++allow.count; + } + } + + } + + allow.uid = new uuid_t[allow.count]; + + size_t i = 0; + for (libhttppp::HttpForm::MultipartForm::Data* curformdat = GPOForm.MultipartFormData.getFormData(); curformdat; curformdat = curformdat->nextData()) { for(libhttppp::HttpForm::MultipartForm::Data::ContentDisposition *curdispo=curformdat->getDisposition(); @@ -1553,21 +1572,30 @@ namespace authdb { ){ if( strcmp(curdispo->getKey(),"name")==0 && curdispo->getValue()!=nullptr){ - if(strcmp(curdispo->getValue(),"gponame")==0 ){ - curformdat->Value.push_back('\0'); - gpodat->setName(curformdat->Value.data()); - }else if(strcmp(curdispo->getValue(),"gpodesc")==0 ){ - curformdat->Value.push_back('\0'); - gpodat->setDesc(curformdat->Value.data()); - }else if(strcmp(curdispo->getValue(),"gpodefaultvalue")==0 ){ - if(strncmp(curformdat->Value.data(),"false",curformdat->Value.size())==0) - gpodat->setGpoValue(false); - else - gpodat->setGpoValue(true); - } + if(strcmp(curdispo->getValue(),"gponame")==0 ){ + curformdat->Value.push_back('\0'); + gpodat->setName(curformdat->Value.data()); + }else if(strcmp(curdispo->getValue(),"gpodesc")==0 ){ + curformdat->Value.push_back('\0'); + gpodat->setDesc(curformdat->Value.data()); + }else if(strcmp(curdispo->getValue(),"gpodefaultvalue")==0 ){ + if(strncmp(curformdat->Value.data(),"false",curformdat->Value.size())==0) + gpodat->setGpoValue(false); + else + gpodat->setGpoValue(true); + }else if(strcmp(curdispo->getValue(),"gpoingroup")==0 ){ + curformdat->Value.push_back('\0'); + uuid_parse(curformdat->Value.data(),allow.uid[i++]); + } } } } + + gpodat->setAllowed(&allow); + + Gpo gpo; + + delete[] allow.uid; } } @@ -1609,9 +1637,10 @@ namespace authdb { delete[] cur.data; } } - form <<"

" - << "

" - <<"" + << "

" + << "

" + <<"" << "" diff --git a/src/gpo.cpp b/src/gpo.cpp index 3cb6e89..f8c5613 100644 --- a/src/gpo.cpp +++ b/src/gpo.cpp @@ -184,7 +184,7 @@ bool authdb::GpoData::getGpoValue(){ -void authdb::GpoData::setAllowed(Allow *allowed, bool dest){ +void authdb::GpoData::setAllowed(Allow *allowed){ AuthData *curec=this; uuid_t gid; diff --git a/src/gpo.h b/src/gpo.h index 70a0803..410835f 100644 --- a/src/gpo.h +++ b/src/gpo.h @@ -48,13 +48,12 @@ namespace authdb { void setGpoValue(bool dest); bool getGpoValue(); - protected: struct Allow { - size_t count; + size_t count; uuid_t *uid; }; public: - void setAllowed(Allow *allowed, bool dest); + void setAllowed(Allow *allowed); void getAlowed(Allow *allowed); private: AuthData::Record *_Name; -- GitLab