1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

The functionality of the creation of general catalogs was expanded for the user

This commit is contained in:
Valery Sinelnikov 2022-12-08 14:44:55 +04:00
parent b4e50c2ef8
commit d9f3bd3b8c
2 changed files with 22 additions and 4 deletions

View File

@ -24,16 +24,19 @@ from gpt.folders import (
)
from util.logging import log
from util.windows import expand_windows_var
from util.util import get_homedir
class Networkshare:
def __init__(self, networkshare_obj):
def __init__(self, networkshare_obj, username = None):
self.net_full_cmd = ['/usr/bin/net', 'usershare']
self.cmd = list()
self.name = networkshare_obj.name
self.path = expand_windows_var(networkshare_obj.path).replace('\\', '/') if networkshare_obj.path else None
if username and self.path:
path_share = self.path.replace(get_homedir(username), '')
self.path = get_homedir(username) + path_share if path_share [0] == '/' else get_homedir(username) + '/' + path_share
self.action = action_letter2enum(networkshare_obj.action)
self.allRegular = networkshare_obj.allRegular
self.comment = networkshare_obj.comment

View File

@ -25,18 +25,24 @@ from util.logging import log
class networkshare_applier(applier_frontend):
__module_name = 'NetworksharesApplier'
__module_name_user = 'NetworksharesApplierUser'
__module_experimental = True
__module_enabled = False
def __init__(self, storage, sid):
def __init__(self, storage, sid, username = None):
self.storage = storage
self.sid = sid
self.username = username
self.networkshare_info = self.storage.get_networkshare(self.sid)
self.__module_enabled = check_enabled(self.storage, self.__module_name, self.__module_experimental)
self.__module_enabled_user = check_enabled(self.storage, self.__module_name_user, self.__module_experimental)
def run(self):
for networkshar in self.networkshare_info:
Networkshare(networkshar)
if self.username:
Networkshare(networkshar, self.username)
else:
Networkshare(networkshar)
def apply(self):
if self.__module_enabled:
@ -44,3 +50,12 @@ class networkshare_applier(applier_frontend):
self.run()
else:
log('D181')
def admin_context_apply(self):
pass
def user_context_apply(self):
if self.__module_enabled_user:
log('D188')
self.run()
else:
log('D189')