36 Commits

Author SHA1 Message Date
f1b94cbfd8 Minor fixes
Some checks failed
CI / build (push) Successful in 10s
CI / release (push) Has been cancelled
2025-06-07 15:29:50 +02:00
1b44dd10db Update readme
All checks were successful
CI / build (push) Successful in 11s
CI / release (push) Has been skipped
2025-06-07 15:05:05 +02:00
1fef08bc55 Check necessary configs 2025-06-07 15:04:56 +02:00
4dc9ea3acb Import groupfolders from configfile 2025-06-07 14:41:31 +02:00
3db83f14fe Add users from configfile 2025-06-07 14:33:00 +02:00
2d1eed4289 Change to akkuman's release action
All checks were successful
CI / build (push) Successful in 10s
CI / release (push) Successful in 9s
2025-06-07 14:01:57 +02:00
45c1182947 Add debug for ci release
All checks were successful
CI / build (push) Successful in 10s
CI / release (push) Successful in 8s
2025-06-07 13:51:24 +02:00
2974629995 Change ci.yml
All checks were successful
CI / build (push) Successful in 10s
CI / release (push) Successful in 8s
2025-06-07 13:46:15 +02:00
c59e7532c2 Change secret
Some checks failed
CI / release (push) Failing after 7s
CI / build (push) Successful in 9s
2025-06-07 12:07:51 +02:00
1430508121 Checkout in release job
Some checks failed
CI / build (push) Successful in 10s
CI / release (push) Failing after 8s
2025-06-07 11:57:17 +02:00
f3d93e1e46 Merge 2 workflows into one
Some checks failed
CI / build (push) Successful in 10s
CI / release (push) Failing after 16s
2025-06-07 11:39:51 +02:00
e98a8daad7 Missing file for the last commit 2025-06-07 11:23:01 +02:00
0a9fe8f4f8 Fix replacement 2025-06-07 11:21:51 +02:00
5d4cd30d95 lock_guard for cfm 2025-06-07 10:16:27 +02:00
f8b66b4e07 Check file persistence 2025-06-07 10:12:36 +02:00
31ec926793 Use configfilemanager to get the real command
All checks were successful
Build / build (push) Successful in 11s
2025-06-07 09:26:15 +02:00
ed068875c3 Implemented configfilemanager 2025-06-06 23:52:05 +02:00
a1b8d589be Fix release job 2025-06-06 21:24:45 +02:00
e95d9bb552 Change ubuntu image to node
All checks were successful
Build / build (push) Successful in 11s
2025-06-02 16:34:25 +02:00
754cc29a83 Use Github's checkout instead of apt git
Some checks failed
Build / build (push) Failing after 3s
2025-06-02 16:30:25 +02:00
bd9ccd33ef Cloning project in CI
Some checks failed
Build / build (push) Failing after 27s
2025-06-02 16:27:29 +02:00
c0a1b0bbd5 Separate the ci jobs
Some checks failed
Build / build (push) Failing after 23s
2025-06-02 16:21:20 +02:00
cd52871632 Remove sudo from ci.yml
Some checks failed
CI / build (push) Failing after 1s
CI / release (push) Has been skipped
2025-06-02 13:55:27 +02:00
a2058ce2d6 Update ci.yml
Some checks failed
CI / build (push) Failing after 1s
CI / release (push) Has been skipped
2025-06-02 13:53:54 +02:00
bad5123b02 Update ci
Some checks failed
CI / build (push) Failing after 21s
CI / release (push) Has been skipped
2025-06-02 13:45:37 +02:00
15fe1b0e9b Update ci
Some checks failed
CI / build (push) Has been cancelled
CI / release (push) Has been cancelled
2025-06-02 13:42:25 +02:00
2951b48680 Added CI
Some checks failed
CI / build (push) Has been cancelled
CI / release (push) Has been cancelled
2025-06-02 13:39:06 +02:00
c494e9697c Modify config files 2025-06-02 13:18:02 +02:00
13f18f99ea Better makefile (AI created) 2025-06-02 13:02:52 +02:00
d58a241abb Merge pull request 'Nextcloud's Groupfolder app support' (#3) from groupfolder-extension-support into main
Reviewed-on: #3
2025-06-01 13:06:45 +02:00
2a9d92a3e3 Delete guarder class 2025-06-01 13:03:24 +02:00
ba4cc3faa3 Support groupfolder scan 2025-06-01 13:03:12 +02:00
029d5716be Added smb.conf file 2025-06-01 12:37:53 +02:00
bcd071018f Merge pull request 'Replace multi-process logic to multi-thread logic' (#2) from process-to-threads into main
Reviewed-on: #2
2025-06-01 12:18:06 +02:00
1113a21b2d Update ncsambawatcher.service 2025-06-01 12:15:52 +02:00
c57b022278 Replace scan to a child process 2025-06-01 12:12:59 +02:00
17 changed files with 443 additions and 120 deletions

79
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,79 @@
name: CI
on:
push:
tags:
- '*' # Triggers on all tags
branches:
- '**' # Triggers on all branches
defaults:
run:
shell: bash
working-directory: .
jobs:
build:
runs-on: ubuntu
container:
image: node:20
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install tools
run: apt update && apt install -y build-essential
- name: Compile project
run: make
- name: Save build output
uses: actions/upload-artifact@v3
with:
name: ncsambawatcher
path: ./ncsambawatcher
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu
container:
image: node:20
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install build tools
run: apt update && apt install -y zip
- name: Download compiled binary
uses: actions/download-artifact@v3
with:
name: ncsambawatcher
- name: Copy files
run: |
mkdir build
cp ncsambawatcher build/ncsambawatcher
cp configs/ncsambawatcher.config.default build/ncsambawatcher.config
cp configs/ncsambawatcher.service.default build/ncsambawatcher.service
cp init.sh build/init.sh
- name: Create release zip
run: |
cd build
ls -al
zip -rv ../ncsambawatcher.zip ./*
cd ../
ls -al
- name: Publish release
uses: akkuman/gitea-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_SECRET }}
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
files: ./ncsambawatcher.zip
token: ${{ secrets.RELEASE_SECRET }}
draft: true

5
.gitignore vendored
View File

@@ -89,4 +89,7 @@ dkms.conf
settings.json settings.json
watch.c watch.c
ncwatchfile ncwatchfile
ncsambawatcher ncsambawatcher
obj/
build/

View File

@@ -1,2 +1,31 @@
all: # Compiler and flags
g++ -lrt -std=c++17 src/main.cpp src/usermanager.cpp src/guarder.cpp -o ncsambawatcher CXX := g++
CXXFLAGS := -std=c++17 -Wall -Wextra -O2
# Directories
SRC_DIR := src
OBJ_DIR := obj
BUILD_DIR := .
TARGET := $(BUILD_DIR)/ncsambawatcher
# Create list of source and object files
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
OBJS := $(SRCS:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
# Default target
all: $(TARGET)
# Link object files into final binary
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^
# Compile .cpp to .o into obj/
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(OBJ_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean build artifacts
clean:
rm -f $(OBJ_DIR)/*.o $(TARGET)
.PHONY: all clean

View File

@@ -1,3 +1,57 @@
# nextcloud-samba-sync # Nextcloud-Samba Sync
A Nextcloud-Samba File scanner system ## Pre installation
- Install `samba` and `vfs-modules`
```
sudo apt update
sudo apt install samba samba-vfs-modules
```
- Create shares. The example is in `configs` folder
## Installation
1. Download a `ncsambawatcher.zip` file from a release above 2.0
2. Extract somewhere on your server (I recommend your user folder)
3. Make sure the samba configuration file is correct (See `configs/smb.24.04.conf`)
4. Configurate the `ncsambawatcher.config` file
<table>
<thead>
<tr>
<td>Name</td>
<td>Required</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>NEXTCLOUD_CONTAINER_NAME</code></td>
<td>Yes</td>
<td>The nextcloud's docker container name</td>
</tr>
<tr>
<td><code>NEXTCLOUD_USERS</code></td>
<td>No</td>
<td>Usernames separated with spaces</td>
</tr>
<tr>
<td><code>NEXTCLOUD_GROUPFOLDER_IDS</code></td>
<td>No</td>
<td>Groupfolder ids separated with spaces (only the number)</td>
</tr>
</tbody>
</table>
Example 1:
```
NEXTCLOUD_CONTAINER_NAME=nextcloud
```
Example 2: (See `configs/ncsambawatcher.config.default`)
5. Run the `init.sh` script
6. You're done :)
## Notes
- You don't need to add users and groupfolders to the configfile because the program add automaticly from the logfile
- For a user (not groupfolder): The username and the samba share name **MUST BE THE SAME**

View File

@@ -0,0 +1,3 @@
NEXTCLOUD_CONTAINER_NAME=nextcloud
NEXTCLOUD_USERS=username1 username2 username3
NEXTCLOUD_GROUPFOLDER_IDS=1 2 3 4

View File

@@ -1,14 +1,14 @@
[Unit] [Unit]
Description=A service which scan Nextcloud folders Description=A service which scan Nextcloud folders
After=network.target After=network.target docker.service
Requires=docker.service
[Service] [Service]
ExecStart=/usr/bin/ncsambawatcher ExecStart=/path/to/folder/ncsambawatcher
WorkingDirectory=/path/to/folder/
Restart=always Restart=always
User=root User=root
Group=root Group=root
WorkingDirectory=/usr/bin/
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal
SyslogIdentifier=ncsambawatcher SyslogIdentifier=ncsambawatcher

48
configs/smb.24.04.conf Normal file
View File

@@ -0,0 +1,48 @@
[global]
vfs objects = full_audit
full_audit:prefix = %u|%I|%m|%S
full_audit:success = mkdirat unlinkat renameat write
full_audit:failure = none
full_audit:facility = local5
full_audit:priority = NOTICE
# Example usershare
[<username>] #CHANGEME
path = /path/to/nextcloud/data/<username>/files/ #CHANGEME
valid users = <username> #CHANGEME
force user = www-data
force group = www-data
create mask = 0755
force create mode = 0755
directory mask = 0755
force directory mode = 0755
guest ok = no
public = no
writable = yes
browsable = yes
hide dot files = no
inherit owner = yes
hide unreadable = no
# Example groupfolder share
[Sharename]
path = /path/to/nextcloud/data/__groupfolders/<groupfolder-id> #CHANGEME
valid users = usernames #CHANGEME
force user = www-data
force group = www-data
create mask = 0755
force create mode = 0755
directory mask = 0755
force directory mode = 0755
guest ok = no
public = no
writable = yes
browsable = yes
hide dot files = no
inherit owner = yes
hide unreadable = no
full_audit:prefix = %u|%I|%m|__groupfolders/<groupfolder-id> #CHANGEME
# To disable logs for a specific share, add this line to that share
[Sharename]
vfs objects =

View File

@@ -1,11 +1,9 @@
#!/bin/bash #!/bin/bash
make current_dir=$(pwd)
sed -i "s|/path/to/folder/|$current_dir/|g" ncsambawatcher.service
sudo cp ncsambawatcher /usr/bin/ sudo cp ./ncsambawatcher.service /etc/systemd/system
sudo chmod +x /usr/bin/ncsambawatcher
sudo cp configs/ncsambawatcher.service /etc/systemd/system
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable ncsambawatcher.service sudo systemctl enable ncsambawatcher.service

View File

@@ -0,0 +1 @@
#include "configfilemanager.h"

68
src/configfilemanager.h Normal file
View File

@@ -0,0 +1,68 @@
#ifndef _CONFIGFILEMANAGER_H
#define _CONFIGFILEMANAGER_H
#include <map>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <mutex>
#include "definitions.h"
class configfilemanager{
private:
std::map<std::string, std::string> configs;
std::mutex mtx;
public:
configfilemanager(std::string filepath = "./ncsambawatcher.config")
{
std::ifstream is(filepath);
if(!is.good())
{
std::cerr << "File not exits: " << filepath << std::endl;
exit(EXIT_FAILURE);
}
std::string tmp;
while(!is.eof())
{
std::getline(is, tmp);
std::cout << tmp << std::endl;
if (tmp.at(0) == '#') // ignore comments
continue;
std::vector<std::string> splited = splitString(tmp, '=');
if (splited.size() != 2)
{
std::cerr << "Invalid line: " << tmp << std::endl;
continue;
}
configs.insert(std::make_pair(splited.at(0), splited.at(1)));
}
if (configs.count("NEXTCLOUD_CONTAINER_NAME") == 0)
{
std::cerr << "The container's name not added" << std::endl;
exit(EXIT_FAILURE);
}
std::cout << "Config file loaded successfuly" << std::endl;
}
std::string at(const std::string &config)
{
std::lock_guard<std::mutex> lock(mtx);
return configs.at(config);
}
std::string at(const char* config)
{
return at(std::string(config));
}
};
#endif // _CONFIGFILEMANAGER_H

13
src/definitions.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef _LOCATIONS_H
#define _LOCATIONS_H
#define LOGFILE "journalctl -u smbd --since now -f"
#define USER_LOG_LOCATION 3
#define SCAN_CMD_USR "docker exec --user www-data %1% /var/www/html/occ files:scan --path="
#define SCAN_CMD_GRP "docker exec --user www-data %1% /var/www/html/occ groupfolder:scan "
std::vector<std::string> splitString(const std::string& input, char delimiter);
#endif // _LOCATIONS_H

View File

@@ -1 +0,0 @@
#include "guarder.h"

View File

@@ -1,66 +0,0 @@
#ifndef _GUARDER_H
#define _GUARDER_H
#include <sys/types.h>
#include <sys/shm.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <unistd.h>
class guarder{
private:
const int shmid;
const int semid;
void semaphoreOp(int op) {
struct sembuf sb{};
sb.sem_num = 0;
sb.sem_op = op;
sb.sem_flg = 0;
semop(semid, &sb, 1);
}
void setFlag(bool value)
{
semaphoreOp(-1);
bool *flag = static_cast<bool *>(shmat(shmid, nullptr, 0));
*flag = value;
shmdt(flag);
semaphoreOp(1);
}
public:
guarder() : shmid(shmget(IPC_PRIVATE, sizeof(bool), 0666 | IPC_CREAT)), semid(semget(IPC_PRIVATE, 1, 0666 | IPC_CREAT))
{
setFlagOff();
}
void setFlagOff()
{
setFlag(false);
}
void setFlagOn()
{
setFlag(true);
}
bool isFlagOn()
{
semaphoreOp(-1);
bool *flag = static_cast<bool *>(shmat(shmid, nullptr, 0));
bool ret = *flag;
shmdt(flag);
semaphoreOp(1);
return ret;
}
~guarder()
{
shmctl(shmid, IPC_RMID, nullptr);
semctl(semid, 0, IPC_RMID);
}
};
#endif // _GUARDER_H

View File

@@ -1,8 +0,0 @@
#ifndef _LOCATIONS_H
#define _LOCATIONS_H
#define LOGFILE "journalctl -u smbd --since now -f"
#define USER_LOG_LOCATION 3
#endif // _LOCATIONS_H

View File

@@ -1,20 +1,38 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#include <vector> #include <vector>
#include <set>
#include <unordered_set>
#include <array> #include <array>
#include <string> #include <string>
#include <mutex> #include <mutex>
#include <condition_variable> #include <condition_variable>
#include <cstdio> #include <cstdio>
#include "definitions.h"
#include "usermanager.h" #include "usermanager.h"
#include "configfilemanager.h"
#define SCAN_CMD_USR "docker exec --user www-data nextcloud /var/www/html/occ files:scan --path=" configfilemanager cfm;
userManager manager; userManager manager;
std::condition_variable cv; std::condition_variable cv;
std::mutex mtx; std::mutex mtx;
std::vector<std::string> splitString(const std::string& str, char delimiter = '|')
{
std::vector<std::string> ret;
std::stringstream ss(str);
std::string token;
while (std::getline(ss, token, delimiter)) {
ret.push_back(token);
}
return ret;
}
void readingThreadFunc() void readingThreadFunc()
{ {
FILE *logpipe = popen(LOGFILE, "r"); FILE *logpipe = popen(LOGFILE, "r");
@@ -27,7 +45,7 @@ void readingThreadFunc()
if (line.find('|') == std::string::npos) if (line.find('|') == std::string::npos)
continue; continue;
std::vector<std::string> x = splitLogFile(line, '|'); std::vector<std::string> x = splitString(line, '|');
std::string user(x.at(USER_LOG_LOCATION)); std::string user(x.at(USER_LOG_LOCATION));
{ {
@@ -45,23 +63,54 @@ void readingThreadFunc()
void scannerThreadFunc() void scannerThreadFunc()
{ {
std::unique_lock<std::mutex> lock(mtx); std::unique_lock<std::mutex> lock(mtx);
std::vector<pid_t> childrens;
while (true) while (true)
{ {
cv.wait(lock, [] cv.wait(lock, []
{ return manager.isAnybodyInQueue(); }); { return manager.isAnybodyFlagged(); });
std::vector<std::string> scanUsers = manager.getFlaggedUsers(); std::unordered_set<std::string> scanUsers = manager.getFlaggedUsers();
manager.unflagAllUsers(); manager.unflagAllUsers();
for (std::vector<std::string>::iterator it = scanUsers.begin(); it != scanUsers.end(); it++) lock.unlock();
childrens.clear();
for (const std::string& user : scanUsers)
{ {
system((std::string(SCAN_CMD_USR) + *it).c_str()); pid_t child = fork();
if (child < 0)
{
std::cerr << "Fork failed for: " << user << std::endl;
}
else if (child == 0) // child
{
std::string cmd = userManager::getScanCommandFromUser(user, cfm);
std::cout << "Run command: " << cmd << std::endl;
execl("/bin/sh", "sh", "-c", cmd.c_str(), static_cast<char *>(nullptr));
std::cerr << "Scan failed" << std::endl;
_exit(EXIT_FAILURE);
}
else // parent
{
childrens.push_back(child);
}
} }
for (const pid_t& pid : childrens)
{
waitpid(pid, nullptr, 0);
}
lock.lock();
} }
} }
int main() int main()
{ {
manager.tryAddUsersFromConfig(cfm);
manager.tryAddGroupIDsFromConfig(cfm);
std::thread readingThread(readingThreadFunc); std::thread readingThread(readingThreadFunc);
std::thread scannerThread(scannerThreadFunc); std::thread scannerThread(scannerThreadFunc);

View File

@@ -1,14 +1,28 @@
#include "usermanager.h" #include "usermanager.h"
std::vector<std::string> splitLogFile(const std::string& input, char delimiter = '|') std::string userManager::getScanCommandFromUser(const std::string &user, configfilemanager &cfm)
{ {
std::vector<std::string> ret; std::string contname = cfm.at("NEXTCLOUD_CONTAINER_NAME");
std::stringstream ss(input); std::string baseCommand;
std::string token; std::string userCommand;
std::string placeholder("%1%");
while (std::getline(ss, token, delimiter)) {
ret.push_back(token); if (user.find("__groupfolder") != std::string::npos)
{
baseCommand = SCAN_CMD_GRP;
userCommand = splitString(user, '/').back();
}
else
{
baseCommand = SCAN_CMD_USR;
userCommand = user;
} }
return ret; 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;
} }

View File

@@ -4,11 +4,12 @@
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
#include <unordered_set>
#include <sstream> #include <sstream>
#include <mutex> #include <mutex>
#include "locations.h" #include <stdexcept>
#include "definitions.h"
std::vector<std::string> splitLogFile(const std::string& input, char delimiter); #include "configfilemanager.h"
class userManager class userManager
{ {
@@ -18,33 +19,37 @@ private:
public: public:
static std::string getScanCommandFromUser(const std::string&, configfilemanager& cfm);
void addUserFromLogLine(std::string &line) void addUserFromLogLine(std::string &line)
{ {
addUser(splitLogFile(line, '|').at(USER_LOG_LOCATION)); addUser(splitString(line, '|').at(USER_LOG_LOCATION));
} }
void addUser(std::string &user) void addUser(const std::string &user)
{ {
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
if (users.count(user) == 0) if (users.count(user) == 0)
{ {
users[user] = false; users[user] = false;
std::cout << "User added the list: " << user << std::endl;
} }
} }
void removeUser(std::string &user) void removeUser(const std::string &user)
{ {
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
users.erase(user); users.erase(user);
std::cout << "User removed the list: " << user << std::endl;
} }
bool isContains(std::string &user) bool isContains(const std::string &user)
{ {
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
return users.count(user) == 1; return users.count(user) == 1;
} }
void setUserFlagged(std::string &user) void setUserFlagged(const std::string &user)
{ {
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
if (users.count(user) == 1) if (users.count(user) == 1)
@@ -53,7 +58,7 @@ public:
} }
} }
void setUserUnflagged(std::string &user) void setUserUnflagged(const std::string &user)
{ {
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
if (users.count(user) == 1) if (users.count(user) == 1)
@@ -71,23 +76,23 @@ public:
} }
} }
std::vector<std::string> getUsers() std::unordered_set<std::string> getUsers()
{ {
std::vector<std::string> ret; std::unordered_set<std::string> ret;
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
for (std::map<std::string, bool>::iterator it = users.begin(); it != users.end(); ++it) for (std::map<std::string, bool>::iterator it = users.begin(); it != users.end(); ++it)
{ {
ret.push_back(it->first); ret.insert(it->first);
} }
return ret; return ret;
} }
std::vector<std::string> getFlaggedUsers() std::unordered_set<std::string> getFlaggedUsers()
{ {
std::vector<std::string> ret; std::unordered_set<std::string> ret;
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
@@ -95,14 +100,14 @@ public:
{ {
if (it->second) if (it->second)
{ {
ret.push_back(it->first); ret.insert(it->first);
} }
} }
return ret; return ret;
} }
bool isAnybodyInQueue() bool isAnybodyFlagged()
{ {
std::lock_guard<std::mutex> lock(mtx); std::lock_guard<std::mutex> lock(mtx);
@@ -114,6 +119,40 @@ public:
return false; return false;
} }
void tryAddUsersFromConfig(configfilemanager &cfm)
{
try
{
std::vector<std::string> alluser = splitString(cfm.at("NEXTCLOUD_USERS"), ' ');
for (const std::string& user : alluser)
{
addUser(user);
}
}
catch (const std::exception &e)
{
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("__groupfolders/" + id);
}
}
catch (const std::exception &e)
{
std::cerr << "No groupfolder added from configuration file" << std::endl;
}
}
}; };
#endif // _USERMAN_H #endif // _USERMAN_H