/*************************************************************************
* UrBackup - Client/Server backup system
* Copyright (C) 2011-2014 Martin Raiber
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
**************************************************************************/
#ifndef CLIENT_ONLY
#include "action_header.h"
#include "../server_status.h"
void getLastActs(Helper &helper, JSON::Object &ret, std::vector clientids);
ACTION_IMPL(progress)
{
Helper helper(tid, &GET, &PARAMS);
JSON::Object ret;
std::vector clientids;
std::string rights=helper.getRights("progress");
if(rights!="none" && rights!="all")
{
std::vector s_cid;
Tokenize(rights, s_cid, ",");
for(size_t i=0;iid==-1) return;
if(session!=NULL && (rights=="all" || !clientids.empty()) )
{
if(GET.find(L"stop_clientid")!=GET.end())
{
int stop_clientid=watoi(GET[L"stop_clientid"]);
std::string stop_rights=helper.getRights("stop_backup");
bool stop_ok=false;
if(stop_rights=="all")
{
stop_ok=true;
}
else
{
std::vector s_cid;
Tokenize(stop_rights, s_cid, ",");
for(size_t i=0;iPrepare("SELECT name FROM clients WHERE id=?");
q_get_name->Bind(stop_clientid);
db_results res=q_get_name->Read();
if(!res.empty())
{
ServerStatus::stopBackup(res[0][L"name"], true);
}
}
}
JSON::Array pg;
std::vector clients=ServerStatus::getStatus();
for(size_t i=0;i s_cid;
Tokenize(rights, s_cid, ",");
for(size_t i=0;i