Import groupfolders from configfile
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
NEXTCLOUD_CONTAINER_NAME=nextcloud
|
||||
NEXTCLOUD_USERS=username1 username2 username3
|
||||
NEXTCLOUD_USERS=username1 username2 username3
|
||||
NEXTCLOUD_GROUPFOLDER_IDS=1 2 3 4
|
||||
@@ -107,6 +107,7 @@ void scannerThreadFunc()
|
||||
int main()
|
||||
{
|
||||
manager.tryAddUsersFromConfig(cfm);
|
||||
manager.tryAddGroupIDsFromConfig(cfm);
|
||||
|
||||
std::thread readingThread(readingThreadFunc);
|
||||
std::thread scannerThread(scannerThreadFunc);
|
||||
|
||||
@@ -136,6 +136,23 @@ public:
|
||||
std::cerr << "No user added from configuration file" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void tryAddGroupIDsFromConfig(configfilemanager &cfm)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::vector<std::string> allids = splitString(cfm.at("NEXTCLOUD_GROUPFOLDER_IDS"), ' ');
|
||||
|
||||
for (const std::string& id : allids)
|
||||
{
|
||||
addUser("__groupfolder/" + id);
|
||||
}
|
||||
}
|
||||
catch (std::exception e)
|
||||
{
|
||||
std::cerr << "No groupfolder added from configuration file" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _USERMAN_H
|
||||
Reference in New Issue
Block a user