From 4187a19c34d6f7aa34c08bc811e8ca90cc883f96 Mon Sep 17 00:00:00 2001 From: Nektarios Katakis Date: Thu, 2 Apr 2020 11:43:53 +0100 Subject: [PATCH] syncthing: add to freedombox-share group Closes: #1808 Test performed: - Install samba in development VM and create open share (owned from root:freedombox-share). - install syncthing and create syncronization folder in the above openshare. - Sync files from desktop peer to development VM one on the above folder. Signed-off-by: Nektarios Katakis Reviewed-by: Veiko Aasa --- plinth/modules/syncthing/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plinth/modules/syncthing/__init__.py b/plinth/modules/syncthing/__init__.py index 3def2d005..a3190ce24 100644 --- a/plinth/modules/syncthing/__init__.py +++ b/plinth/modules/syncthing/__init__.py @@ -12,11 +12,12 @@ from plinth.daemon import Daemon from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall from plinth.modules.users.components import UsersAndGroups +from plinth.modules.users import add_user_to_share_group from plinth.utils import format_lazy from .manifest import backup, clients # noqa, pylint: disable=unused-import -version = 2 +version = 3 managed_services = ['syncthing@syncthing'] @@ -38,6 +39,8 @@ _description = [ box_name=_(cfg.box_name)), ] +SYSTEM_USER = 'syncthing' + app = None @@ -87,8 +90,8 @@ class SyncthingApp(app_module.App): daemon = Daemon('daemon-syncthing', managed_services[0]) self.add(daemon) - users_and_groups = UsersAndGroups('users-and-groups-syncthing', - groups=self.groups) + users_and_groups = UsersAndGroups( + 'users-and-groups-syncthing', [SYSTEM_USER], self.groups) self.add(users_and_groups) @@ -111,3 +114,5 @@ def setup(helper, old_version=None): if old_version == 1 and app.is_enabled(): app.get_component('firewall-syncthing-ports').enable() + + add_user_to_share_group(SYSTEM_USER, managed_services[0])