Commit 415e782b authored by jan.koester's avatar jan.koester
Browse files

test

parent 5da3c32f
Loading
Loading
Loading
Loading
+4 −4
Changes for src/edit.cpp: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -62,10 +62,11 @@ blogi::webedit::WebEditor::WebEditor(PluginArgs &plgargs) : Args (plgargs){

void blogi::webedit::WebEditor::registerEditorGPOs(){
    auto reg = [&](const char *gpoid, const char *name, const char *desc){
        try {
        if(Args.config->getAuthSourceCount() < 1)
            return;
            const AuthSource &src = Args.config->getAuthSource(0);
        for(size_t i = 0; i < Args.config->getAuthSourceCount(); ++i){
            try {
                const AuthSource &src = Args.config->getAuthSource(i);
                authdb::client::ClientConnection authcon;
                authcon.setUrl(src.url);
                authcon.setClientName(src.clientName);
@@ -73,15 +74,14 @@ void blogi::webedit::WebEditor::registerEditorGPOs(){
                authdb::client::Client clt(authcon);
                if(clt.ClientAuth()){
                    uuid::uuid gid(gpoid);
                if(!clt.GPOexits(gid)){
                    clt.GPOadd(gid, name, desc, true, {});
                }
            }
            } catch(const std::exception &e) {
                std::cerr << "Editor GPO registration failed for " << name << ": " << e.what() << std::endl;
            } catch(...) {
                std::cerr << "Editor GPO registration failed for " << name << std::endl;
            }
        }
    };
    reg(GPO_EDITOR_PUBLISH,      "Blogi: Publish Content",   "Controls access to publishing content from the editor");
    reg(GPO_EDITOR_SHARE,        "Blogi: Share Posts",        "Controls access to sharing posts to social networks");
+4 −4
Changes for src/plugin.cpp: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -98,10 +98,11 @@ void blogi::PluginApi::initPlugin(){
}

void blogi::PluginApi::registerGPO(const char *gpoid, const char *name, const char *desc, bool gpodefault){
    try {
    if(Args->config->getAuthSourceCount() < 1)
        return;
        const AuthSource &src = Args->config->getAuthSource(0);
    for(size_t i = 0; i < Args->config->getAuthSourceCount(); ++i){
        try {
            const AuthSource &src = Args->config->getAuthSource(i);
            authdb::client::ClientConnection authcon;
            authcon.setUrl(src.url);
            authcon.setClientName(src.clientName);
@@ -109,16 +110,15 @@ void blogi::PluginApi::registerGPO(const char *gpoid, const char *name, const ch
            authdb::client::Client clt(authcon);
            if(clt.ClientAuth()){
                uuid::uuid gid(gpoid);
            if(!clt.GPOexits(gid)){
                clt.GPOadd(gid, name, desc, gpodefault, {});
            }
        }
        } catch(const std::exception &e) {
            std::cerr << "GPO registration failed for " << name << ": " << e.what() << std::endl;
        } catch(...) {
            std::cerr << "GPO registration failed for " << name << std::endl;
        }
    }
}

bool blogi::PluginApi::haveSettings(){
    return false;