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 <iam@nektarioskatakis.xyz>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Nektarios Katakis 2020-04-02 11:43:53 +01:00
parent 1b3359faf7
commit 4187a19c34
No known key found for this signature in database
GPG Key ID: 9CA475E691EBCF76

View File

@ -12,11 +12,12 @@ from plinth.daemon import Daemon
from plinth.modules.apache.components import Webserver from plinth.modules.apache.components import Webserver
from plinth.modules.firewall.components import Firewall from plinth.modules.firewall.components import Firewall
from plinth.modules.users.components import UsersAndGroups from plinth.modules.users.components import UsersAndGroups
from plinth.modules.users import add_user_to_share_group
from plinth.utils import format_lazy from plinth.utils import format_lazy
from .manifest import backup, clients # noqa, pylint: disable=unused-import from .manifest import backup, clients # noqa, pylint: disable=unused-import
version = 2 version = 3
managed_services = ['syncthing@syncthing'] managed_services = ['syncthing@syncthing']
@ -38,6 +39,8 @@ _description = [
box_name=_(cfg.box_name)), box_name=_(cfg.box_name)),
] ]
SYSTEM_USER = 'syncthing'
app = None app = None
@ -87,8 +90,8 @@ class SyncthingApp(app_module.App):
daemon = Daemon('daemon-syncthing', managed_services[0]) daemon = Daemon('daemon-syncthing', managed_services[0])
self.add(daemon) self.add(daemon)
users_and_groups = UsersAndGroups('users-and-groups-syncthing', users_and_groups = UsersAndGroups(
groups=self.groups) 'users-and-groups-syncthing', [SYSTEM_USER], self.groups)
self.add(users_and_groups) self.add(users_and_groups)
@ -111,3 +114,5 @@ def setup(helper, old_version=None):
if old_version == 1 and app.is_enabled(): if old_version == 1 and app.is_enabled():
app.get_component('firewall-syncthing-ports').enable() app.get_component('firewall-syncthing-ports').enable()
add_user_to_share_group(SYSTEM_USER, managed_services[0])