mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
polkit_applier: Check if module is enabled via policy
This commit is contained in:
parent
023739444b
commit
a74e29d335
@ -16,13 +16,19 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .applier_frontend import applier_frontend
|
||||
from .applier_frontend import (
|
||||
applier_frontend
|
||||
, check_module_enabled
|
||||
)
|
||||
from .appliers.polkit import polkit
|
||||
from util.logging import slogm
|
||||
|
||||
import logging
|
||||
|
||||
class polkit_applier(applier_frontend):
|
||||
__module_name = 'polkit_applier'
|
||||
__module_experimental = False
|
||||
__module_enabled = True
|
||||
__deny_all = 'Software\\Policies\\Microsoft\\Windows\\RemovableStorageDevices\\Deny_All'
|
||||
__polkit_map = {
|
||||
__deny_all: ['49-gpoa_disk_permissions', { 'Deny_All': 0 }]
|
||||
@ -41,15 +47,20 @@ class polkit_applier(applier_frontend):
|
||||
logging.debug(slogm('Deny_All setting not found'))
|
||||
self.policies = []
|
||||
self.policies.append(polkit(template_file, template_vars))
|
||||
self.__module_enabled = check_module_enabled(self.storage, self.__module_name, self.__module_enabled)
|
||||
|
||||
def apply(self):
|
||||
'''
|
||||
Trigger control facility invocation.
|
||||
'''
|
||||
for policy in self.policies:
|
||||
policy.generate()
|
||||
if self.__module_enabled:
|
||||
for policy in self.policies:
|
||||
policy.generate()
|
||||
|
||||
class polkit_applier_user(applier_frontend):
|
||||
__module_name = 'polkit_applier_user'
|
||||
__module_experimental = False
|
||||
__module_enabled = True
|
||||
__deny_all = 'Software\\Policies\\Microsoft\\Windows\\RemovableStorageDevices\\Deny_All'
|
||||
__polkit_map = {
|
||||
__deny_all: ['48-gpoa_disk_permissions_user', { 'Deny_All': 0, 'User': '' }]
|
||||
@ -72,6 +83,7 @@ class polkit_applier_user(applier_frontend):
|
||||
logging.debug(slogm('Deny_All setting not found'))
|
||||
self.policies = []
|
||||
self.policies.append(polkit(template_file, template_vars, self.username))
|
||||
self.__module_enabled = check_module_enabled(self.storage, self.__module_name, self.__module_enabled)
|
||||
|
||||
def user_context_apply(self):
|
||||
pass
|
||||
@ -80,6 +92,7 @@ class polkit_applier_user(applier_frontend):
|
||||
'''
|
||||
Trigger control facility invocation.
|
||||
'''
|
||||
for policy in self.policies:
|
||||
policy.generate()
|
||||
if self.__module_enabled:
|
||||
for policy in self.policies:
|
||||
policy.generate()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user