diff --git a/pym/desktop/desktop.py b/pym/desktop/desktop.py index 850c411..8af9cb7 100644 --- a/pym/desktop/desktop.py +++ b/pym/desktop/desktop.py @@ -29,7 +29,8 @@ from calculate.lib.cl_template import (Template, ProgressTemplate, TemplatesError,templateFunction,iniParser) from calculate.lib.utils.files import (runOsCommand, isMount,process, getRunCommands,STDOUT,childMounts,getLoopFromPath, - getMdRaidDevices,listDirectory,removeDir) + getMdRaidDevices,listDirectory,removeDir, + makeDirectory) from calculate.lib.utils.common import (getpathenv,appendProgramToEnvFile, removeProgramToEnvFile,mountEcryptfs, CommonError, isBootstrapDataOnly) @@ -245,6 +246,23 @@ class Desktop: return False return True + def setFastlogin(self, urLogin): + """ + Отметить пользователя, что для него может быть + использовать "быстрой логин" + """ + fastlogin = self.clVars.Get('cl_desktop_fastlogin_path') + if not path.exists(fastlogin): + makeDirectory(fastlogin) + fastlogin_user = path.join(fastlogin, urLogin) + if not path.exists(fastlogin_user): + try: + open(fastlogin_user,'w').close() + return True + except: + self.printWARNING(_("Failed to create the fastlogin mark file")) + return False + def userLogout(self, urLogin): """ Выполнить logout пользователя через dbus diff --git a/pym/desktop/utils/cl_desktop.py b/pym/desktop/utils/cl_desktop.py index 9968d3a..82ad2ef 100644 --- a/pym/desktop/utils/cl_desktop.py +++ b/pym/desktop/utils/cl_desktop.py @@ -92,6 +92,11 @@ class ClDesktopAction(Action): 'condition':lambda Get: Get('cl_desktop_force_setup_set') == 'on' or \ Get('cl_desktop_update_profile_set') == 'on' }, + {'name':'fast_login', + 'method':'Desktop.setFastlogin(ur_login)', + 'essential':False, + 'condition':lambda Get: Get('ur_domain_set') == 'off' + }, # отключить ресурсы подключенные в каталоге пользователя {'name':'umount_userres', 'message': _("Unmouning user resources"), diff --git a/pym/desktop/variables/desktop.py b/pym/desktop/variables/desktop.py index 82fe5e9..67b82d7 100644 --- a/pym/desktop/variables/desktop.py +++ b/pym/desktop/variables/desktop.py @@ -406,3 +406,10 @@ class VariableClDesktopHashFace(Variable): hashlib.md5(login).digest()))%len(icon_list)]) else: return "" + +class VariableClDesktopFastloginPath(ReadonlyVariable): + """ + Путь до каталога в котором указаны пользователи быстрого входа в сеанс + """ + value = "/var/lib/calculate/calculate-desktop/fastlogin" +