/* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- */
//  SPDX-License-Identifier: AGPL-3.0-only
//
//  Copyright 2022         OpenVPN Inc <sales@openvpn.net>
//  Copyright 2022         David Sommerseth <davids@openvpn.net>
//
//
//  This is a targetted policy to allow users in the "connector" group
//  to manipulate the openvpn3-session@OpenVPNCloud.service unit
//

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.systemd1.manage-unit-files")
    {
        if (subject.isInGroup("connector") && subject.active)
        {
            polkit.log("cockpit-openvpn-connector.rules: Granted " + action.id
		       + " access to user/group: "
                       + subject.user + "/" + subject.groups);
            return polkit.Result.YES;
        }
    }
});

