28 lines
804 B
C++
28 lines
804 B
C++
#include "usermanager.h"
|
|
|
|
std::string userManager::getScanCommandFromUser(const std::string &user, configfilemanager &cfm)
|
|
{
|
|
std::string contname = cfm.at("NEXTCLOUD_CONTAINER_NAME");
|
|
std::string baseCommand;
|
|
std::string userCommand;
|
|
std::string placeholder("%1%");
|
|
|
|
if (user.find("__groupfolder") != std::string::npos)
|
|
{
|
|
baseCommand = SCAN_CMD_GRP;
|
|
userCommand = splitString(user, '/').back();
|
|
}
|
|
else
|
|
{
|
|
baseCommand = SCAN_CMD_USR;
|
|
userCommand = user;
|
|
}
|
|
|
|
size_t pos = 0;
|
|
while ((pos = baseCommand.find(placeholder, pos)) != std::string::npos) {
|
|
baseCommand.replace(pos, placeholder.length(), contname);
|
|
pos += contname.length(); // Move past the replacement
|
|
}
|
|
|
|
return baseCommand + userCommand;
|
|
} |