develop
asamoukin 16 years ago
parent 519cfb3a66
commit e3ad23307c

@ -173,14 +173,19 @@ WHEN may be 'never', 'always', or 'auto'")
{'progAccess':(2,),
'longOption':"login",
'helpChapter':_("Common options"),
'help':_("mount user resources")+ " " +\
'help':_("mount user resource")+ " " +\
_("and synchronize the user preferences")
},
{'progAccess':(2,),
'longOption':"logout",
'helpChapter':_("Common options"),
'help':_("Synchronize the user preferences") + " " +\
_("and umount user resources")
_("and umount user resource")
},
{'progAccess':(2,),
'longOption':"nosync",
'helpChapter':_("Common options"),
'help':_("Umount user resource")
},
#{'progAccess':(0,),
#'shortOption':"p",
@ -739,9 +744,50 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
self.printERROR(_("Keep a user profile in the domain"))
return False
self.printSUCCESS(_("Keep a user profile in the domain"))
self.printOK(_("Umount user resources in domain") + " ...")
self.printOK(_("Umount user resource in domain") + " ...")
return True
def umountUserResNoSync(self, userName):
"""Отмонтирование пользовательских ресурсов
без синхронизации настроек"""
# Подсоединяемся к серверу
domain = self.clVars.Get("cl_remote_host")
if not self.getLdapObjBind(domain):
return False
# homeDir из LDAP
resLdap = self.getUserLdapInfo(userName)
if not resLdap:
return False
homeDir = resLdap[4]
home = os.path.split(homeDir)[0]
pathRemote = []
# Удаленный ресурс профилей
pathRemote.append((os.path.join(home,"." + userName), "unix"))
# Удаленный ресурс home
pathRemote.append((os.path.join(homeDir,"Home"), "homes"))
# Удаленный ресурс share
pathRemote.append((os.path.join(homeDir,"Disks"), "share"))
flagError = False
for path, res in pathRemote:
if self.isMount(path ,"cifs"):
textLine = self.execProg("umount %s"%path)
if not (textLine == None):
self.printERROR(_("Can not umount dir %s")%path + " ...")
flagError = True
break
if os.path.exists(path) and not os.listdir(path):
try:
os.rmdir(path)
except:
self.printERROR(_("Can not remove dir %s")% path)
flagError = True
break
if flagError:
self.printERROR(_("Can not umount user %s resource")%userName)
return False
self.printOK(_("Umount user %s resource") %userName + " ...")
return True
def mountUserRes(self, userName):
"""Монтирование пользовательских ресурсов и синхронизация настроек"""
@ -819,7 +865,7 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
# Синхронизируем настройки
if not self.syncUser(userName, homeDir, "login"):
return False
self.printSUCCESS(_("Mount user resources in domain"))
self.printSUCCESS(_("Mount user resource in domain"))
self.printOK(_("Get a user profile in the domain") + " ...")
return True

@ -60,6 +60,10 @@ if __name__ == "__main__":
userName = optObj.params['user']
if not ldapObj.umountUserRes(userName):
flagError = True
elif optObj.opt.has_key('nosync'):
userName = optObj.params['user']
if not ldapObj.umountUserResNoSync(userName):
flagError = True
if optObj.opt.has_key('color'):
if len(optObj.opt) == 1:
optObj.handlerErrOpt()

Loading…
Cancel
Save