diff --git a/src/admin.cpp b/src/admin.cpp index c93ca16c3a94a35c07c83c3cdc83e17fefa131f5..3f0fb8ecac57ea818e8d18ba06b656ce887f9d3e 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 3cb6e89ef6c940c415643a2ae0be1d2e41829606..f8c56137160dafda40060bfc7cb2f528f9b038a2 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 70a08039fb6fd77922267ef7a57b123a6a3c4f54..410835f53f164ff8e739be26d2a6920721147f8e 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;