OpenVPN: Create user group "vpn"

A user in this user group will be able to download and use an .ovpn
profile to connect to the OpenVPN server on the FreedomBox.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2020-11-12 05:49:36 +05:30 committed by James Valleroy
parent 8f98db9a69
commit 7663b763f9
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -13,6 +13,7 @@ from plinth import app as app_module
from plinth import cfg, frontpage, menu from plinth import cfg, frontpage, menu
from plinth.daemon import Daemon from plinth.daemon import Daemon
from plinth.modules.firewall.components import Firewall from plinth.modules.firewall.components import Firewall
from plinth.modules.users.components import UsersAndGroups
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
@ -52,6 +53,9 @@ class OpenVPNApp(app_module.App):
def __init__(self): def __init__(self):
"""Create components for the app.""" """Create components for the app."""
super().__init__() super().__init__()
self.groups = {'vpn': _('Connect to VPN services')}
info = app_module.Info(app_id=self.app_id, version=version, info = app_module.Info(app_id=self.app_id, version=version,
name=_('OpenVPN'), icon_filename='openvpn', name=_('OpenVPN'), icon_filename='openvpn',
short_description=_('Virtual Private Network'), short_description=_('Virtual Private Network'),
@ -83,6 +87,10 @@ class OpenVPNApp(app_module.App):
listen_ports=[(1194, 'udp4'), (1194, 'udp6')]) listen_ports=[(1194, 'udp4'), (1194, 'udp6')])
self.add(daemon) self.add(daemon)
users_and_groups = UsersAndGroups('users-and-groups-openvpn',
groups=self.groups)
self.add(users_and_groups)
def is_enabled(self): def is_enabled(self):
"""Return whether all the leader components are enabled. """Return whether all the leader components are enabled.