diff --git a/pym/cl_client.py b/pym/cl_client.py index 08d3d47..43062ee 100644 --- a/pym/cl_client.py +++ b/pym/cl_client.py @@ -873,8 +873,29 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw) self.printOK(_("Umount user %s resource") %userName + " ...") return True + def isTwoSessionsUser(self, userName): + """Проверка на повторный вход пользователя""" + xSession = 0 + foundTwoSession = False + reFoundUser = re.compile("%s\s:\d+\s+"%(userName)) + resWho = self.execProg("who",False,False) + if resWho and type(resWho) == types.ListType: + for string in resWho: + if reFoundUser.search(string): + xSession +=1 + if xSession>1: + foundTwoSession = True + self.printERROR(\ + _("Second X session for user %s can not be opened.")\ + %userName) + break + return foundTwoSession + def mountUserRes(self, userName, sync=True): """Монтирование пользовательских ресурсов и синхронизация настроек""" + # Проверка на повторный вход пользователя + if self.isTwoSessionsUser(userName): + return False self.createClVars() # В случае компьютера вне домена if not self.clVars.Get("cl_remote_host"):