Исправлена проверка доступа на запись при изменении профиля
master 3.7.2.72
root 1 year ago
parent 4426fbee48
commit 54e3fc5881

@ -28,7 +28,7 @@ from calculate.lib.datavars import (Variable, VariableError,
SimpleDataVars, DataVarsError) SimpleDataVars, DataVarsError)
from calculate.lib.utils.binhosts import (Binhosts, PackagesIndex, HOURS, from calculate.lib.utils.binhosts import (Binhosts, PackagesIndex, HOURS,
BinhostSignError) BinhostSignError)
from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin, quite_unlink from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin
from calculate.lib.configparser import ConfigParser from calculate.lib.configparser import ConfigParser
from calculate.lib.cl_lang import setLocalTranslate from calculate.lib.cl_lang import setLocalTranslate
@ -964,25 +964,11 @@ class VariableClUpdateProfileDependUrl(FieldValue, ReadonlyVariable):
class VariableClUpdateProfileCheckSyncAllowed(Variable): class VariableClUpdateProfileCheckSyncAllowed(Variable):
urls = 'cl_update_rep_url' path = 'cl_update_repos_storage'
names = 'cl_update_rep_name'
path = 'cl_update_profile_path'
cache_path = 'cl_update_package_cache'
def get(self): def get(self):
if not self.Get(self.urls) or not self.Get(self.names): repo_path = path.join(self.Get(self.path), self.Get('cl_update_profile_repo_name'))
return False if path.exists(repo_path) and not os.access(repo_path, os.W_OK):
repos = self.Get(self.path)
try:
for rep in repos:
with open(f'{rep}/test', 'w') as inf:
inf.write("test")
os.unlink(f"{rep}/test")
path = self.Get(self.cache_path)
with open(f'{path}/test', 'w') as inf:
inf.write("test")
os.unlink(f"{path}/test")
except OSError:
return False return False
return True return True

Loading…
Cancel
Save