From 5759612ef4dfcb61a4f7e4e22d565000599490cf Mon Sep 17 00:00:00 2001 From: asamoukin Date: Thu, 13 Nov 2008 07:33:05 +0000 Subject: [PATCH] git-svn-id: http://svn.calculate.ru/calculate2/calculate-server/trunk@446 c91db197-33c1-4113-bf15-f8a5c547ca64 --- pym/cl_ldap.py | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/pym/cl_ldap.py b/pym/cl_ldap.py index 6660b8f..b1be697 100644 --- a/pym/cl_ldap.py +++ b/pym/cl_ldap.py @@ -1882,7 +1882,7 @@ service")) " ...") return False - def modUserUnixServer(self,userName, options): + def modUserUnixServer(self,userName, options, printSuccess=True): """Модифицирует настройки пользователя Unix в LDAP""" res = self.searchUnixUser(userName) if not res: @@ -1907,8 +1907,9 @@ service")) break if flagError: return False - self.printSUCCESS(_("Replaced list of supplementary group")+\ - " ...") + if printSuccess: + self.printSUCCESS(_("Replaced list of supplementary group")+\ + " ...") # Добавляем группы в которые входит пользователь elif options.has_key('a'): userGroups = options['a'].split(',') @@ -1923,7 +1924,8 @@ service")) break if flagError: return False - self.printSUCCESS( + if printSuccess: + self.printSUCCESS(\ _("Appended the user to the supplemental groups") + " ...") # Изменяемые аттрибуты пользователя modAttrs = [] @@ -2005,31 +2007,41 @@ service")) self.modAttrsDN(DN, modAttrs) return False else: - self.printSUCCESS(_("Moved home directory") + " ...") + if printSuccess: + self.printSUCCESS(_("Moved home directory") + " ...") if options.has_key('c'): - self.printSUCCESS(_("Modified comment") + " ...") + if printSuccess: + self.printSUCCESS(_("Modified comment") + " ...") if options.has_key('s'): - self.printSUCCESS(_("Modified shell") + " ...") + if printSuccess: + self.printSUCCESS(_("Modified shell") + " ...") if options.has_key('d'): - self.printSUCCESS(_("Modified home directory") + " ...") + if printSuccess: + self.printSUCCESS(_("Modified home directory") + " ...") if options.has_key('P') or options.has_key('p'): # Изменим время последнего измения пароля пользователя if not self.setShadowLastChange(userName): return False - self.printSUCCESS(_("Modified user password of Unix service")+\ + if printSuccess: + self.printSUCCESS(\ + _("Modified user password of Unix service")+\ " ...") if options.has_key('U'): - self.printSUCCESS(_("Unlocked user %s")% str(userName) +\ - " ...") + if printSuccess: + self.printSUCCESS(_("Unlocked user %s")% str(userName) +\ + " ...") if options.has_key('I'): - self.printSUCCESS(_("User %s is invisible")% str(userName) +\ - " ...") + if printSuccess: + self.printSUCCESS(\ + _("User %s is invisible")% str(userName) + " ...") if options.has_key('V'): - self.printSUCCESS(_("User %s is visible")% str(userName) +\ - " ...") + if printSuccess: + self.printSUCCESS(_("User %s is visible")% str(userName)+\ + " ...") if options.has_key('L'): - self.printSUCCESS(_("Locked user %s")% str(userName) +\ - " ...") + if printSuccess: + self.printSUCCESS(_("Locked user %s")% str(userName) +\ + " ...") return True def modUserUnixPasswd(self, userName, options, pwd=False): @@ -3984,7 +3996,7 @@ class servSamba(shareLdap): if not userNetlogonDir in notDeletedDirs and\ os.path.exists(userNetlogonDir): self.removeDir(userNetlogonDir) - if not self.servUnixObj.modUserUnixServer(userName, {"I":""}): + if not self.servUnixObj.modUserUnixServer(userName,{"I":""},False): return False if printSuccess: self.printSUCCESS(_("Deleted Samba user %s") % str(delUser) +\ @@ -4049,7 +4061,7 @@ class servSamba(shareLdap): if not self.servUnixObj.modUserUnixPasswd(userName, {}, userPwd): return False else: - if not self.servUnixObj.modUserUnixServer(userName, {"V":""}): + if not self.servUnixObj.modUserUnixServer(userName,{"V":""},False): return False if userPwd: textLine = self.execProg("smbpasswd -a -s %s" %(userName),