|
|
|
@ -2887,7 +2887,7 @@ class servMail(shareLdap):
|
|
|
|
|
if not servReplObj.delReplMailAlias(userName):
|
|
|
|
|
self.printERROR (_("ERROR") + ": " +\
|
|
|
|
|
_("Cannot delete email alias \
|
|
|
|
|
for user %s in 'Replicatinon/Mail' branch ...") %str(userName) + " ...")
|
|
|
|
|
for user %s in 'Replication/Mail' branch ...") %str(userName) + " ...")
|
|
|
|
|
return False
|
|
|
|
|
# Удаляем пользователя из групп
|
|
|
|
|
if not self.delUserInGroup(userName):
|
|
|
|
@ -3013,7 +3013,7 @@ for user %s in 'Replicatinon/Mail' branch ...") %str(userName) + " ...")
|
|
|
|
|
if not servReplObj.delReplMailAlias(groupName):
|
|
|
|
|
self.printERROR (_("ERROR") + ": " +\
|
|
|
|
|
_("Cannot delete email alias \
|
|
|
|
|
for group %s in 'Replicatinon/Mail' branch ...") %str(userName) + " ...")
|
|
|
|
|
for group %s in 'Replication/Mail' branch ...") %str(userName) + " ...")
|
|
|
|
|
return False
|
|
|
|
|
self.printSUCCESS( _("Mail group %s is deleted")%groupName + \
|
|
|
|
|
" ...")
|
|
|
|
@ -3049,7 +3049,10 @@ for group %s in 'Replicatinon/Mail' branch ...") %str(userName) + " ...")
|
|
|
|
|
self.printERROR(_("Command Line Options '-n' and '-e' are \
|
|
|
|
|
incompatible, use one of the options"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
if options.has_key('hide') and options.has_key('hide-off'):
|
|
|
|
|
self.printERROR(_("Command Line Options '--hide' and '--hide-off' \
|
|
|
|
|
are incompatible, use one of the options"))
|
|
|
|
|
return False
|
|
|
|
|
attrDelete = []
|
|
|
|
|
attrDeleteFirst = []
|
|
|
|
|
attrAppend = []
|
|
|
|
@ -3070,7 +3073,9 @@ incompatible, use one of the options"))
|
|
|
|
|
filterHosts)
|
|
|
|
|
for host in fHosts:
|
|
|
|
|
attrAppend.append((ldap.MOD_ADD, 'filtersender', host))
|
|
|
|
|
|
|
|
|
|
if options.has_key('hide-off'):
|
|
|
|
|
if searchGroup[0][0][1].has_key('filtersender'):
|
|
|
|
|
attrDeleteFirst.append((ldap.MOD_DELETE, 'filtersender', None))
|
|
|
|
|
if options.has_key('e'):
|
|
|
|
|
altMails = options['e'].split(",")
|
|
|
|
|
email = searchGroup[0][0][1]["mail"][0]
|
|
|
|
@ -3115,6 +3120,12 @@ option '-e'"))
|
|
|
|
|
_("(%s)"%", ".join(altMails))+ " ..."
|
|
|
|
|
self.printERROR(errorMsg)
|
|
|
|
|
return False
|
|
|
|
|
if options.has_key('hide-off'):
|
|
|
|
|
if not servReplObj.deleteHideHosts(groupName):
|
|
|
|
|
errorMsg = _("Can not delete hide host in mail alias,") +\
|
|
|
|
|
" " + _("for name %s")%groupName + " ..."
|
|
|
|
|
self.printERROR(errorMsg)
|
|
|
|
|
return False
|
|
|
|
|
# Добавляем список пользователей в группу
|
|
|
|
|
if options.has_key('a'):
|
|
|
|
|
# добавляемые пользователи в группу
|
|
|
|
@ -3182,7 +3193,7 @@ option '-e'"))
|
|
|
|
|
if servReplObj:
|
|
|
|
|
if not servReplObj.renameReplMailAlias(groupName, newGroupName):
|
|
|
|
|
self.printERROR(_("Failed modify name '%s' mail alias \
|
|
|
|
|
in 'Replicatinon/Mail' branch ...") %groupName)
|
|
|
|
|
in 'Replication/Mail' branch ...") %groupName)
|
|
|
|
|
return False
|
|
|
|
|
if res:
|
|
|
|
|
self.printSUCCESS(_("Group renamed") + " ...")
|
|
|
|
@ -3195,6 +3206,11 @@ in 'Replicatinon/Mail' branch ...") %groupName)
|
|
|
|
|
if options.has_key('c'):
|
|
|
|
|
gecos = options['c']
|
|
|
|
|
modAttrs.append((ldap.MOD_REPLACE, 'description', gecos))
|
|
|
|
|
if not modAttrs:
|
|
|
|
|
if options.has_key('hide-off'):
|
|
|
|
|
self.printWARNING(\
|
|
|
|
|
_("Hide mail hosts have already been deleted") + " ...")
|
|
|
|
|
return True
|
|
|
|
|
if modAttrs:
|
|
|
|
|
groupDN = self.addDN("cn=" + modGroupName, self.relGroupsDN)
|
|
|
|
|
res = self.modAttrsDN(groupDN, modAttrs)
|
|
|
|
@ -3207,6 +3223,9 @@ in 'Replicatinon/Mail' branch ...") %groupName)
|
|
|
|
|
if options.has_key('hide'):
|
|
|
|
|
self.printSUCCESS(_("Modified hide mail hosts") +\
|
|
|
|
|
" ...")
|
|
|
|
|
if options.has_key('hide-off'):
|
|
|
|
|
self.printSUCCESS(_("Deleted hide mail hosts") +\
|
|
|
|
|
" ...")
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
if options.has_key('c'):
|
|
|
|
@ -3219,6 +3238,9 @@ in 'Replicatinon/Mail' branch ...") %groupName)
|
|
|
|
|
if options.has_key('hide'):
|
|
|
|
|
self.printERROR(_("Can not modify hide mail hosts") +\
|
|
|
|
|
" ...")
|
|
|
|
|
if options.has_key('hide-off'):
|
|
|
|
|
self.printERROR(_("Can not delete hide mail hosts") +\
|
|
|
|
|
" ...")
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -3335,7 +3357,7 @@ in Unix service ...") %str(primaryMail))
|
|
|
|
|
servReplObj = servRepl()
|
|
|
|
|
if not servReplObj.modReplMailAlias(userName, altMails):
|
|
|
|
|
self.printERROR(_("Failed modify mail aliases \
|
|
|
|
|
for user %s in 'Replicatinon/Mail' branch ...") %userName)
|
|
|
|
|
for user %s in 'Replication/Mail' branch ...") %userName)
|
|
|
|
|
return False
|
|
|
|
|
if modAttrs:
|
|
|
|
|
DN = self.addDN("uid="+userName, self.relUsersDN)
|
|
|
|
@ -3369,7 +3391,7 @@ for user %s in 'Replicatinon/Mail' branch ...") %userName)
|
|
|
|
|
servReplObj = servRepl()
|
|
|
|
|
if servReplObj.searchMailAlias(groupName):
|
|
|
|
|
self.printERROR(_("Mail group %s is found in \
|
|
|
|
|
'Replicatinon/Mail' branch")%groupName + " ...")
|
|
|
|
|
'Replication/Mail' branch")%groupName + " ...")
|
|
|
|
|
return False
|
|
|
|
|
#Проверяем альтернативные почтовые адреса
|
|
|
|
|
modAttrs = []
|
|
|
|
@ -3437,7 +3459,7 @@ option '-e'"))
|
|
|
|
|
altMails,
|
|
|
|
|
fHostNames):
|
|
|
|
|
self.printERROR(_("Failed set mail aliases \
|
|
|
|
|
for user %s in 'Replicatinon/Mail' branch ...") %str(primaryMail))
|
|
|
|
|
for user %s in 'Replication/Mail' branch ...") %str(primaryMail))
|
|
|
|
|
return False
|
|
|
|
|
self.printSUCCESS(_("Added group in Mail service") + " ...")
|
|
|
|
|
return True
|
|
|
|
@ -3641,7 +3663,7 @@ for user %s in 'Replicatinon/Mail' branch ...") %str(primaryMail))
|
|
|
|
|
servReplObj = servRepl()
|
|
|
|
|
if servReplObj.searchMailAlias(userName):
|
|
|
|
|
self.printERROR(_("Mail user %s is found in \
|
|
|
|
|
'Replicatinon/Mail' branch")%userName + " ...")
|
|
|
|
|
'Replication/Mail' branch")%userName + " ...")
|
|
|
|
|
return False
|
|
|
|
|
#Проверяем альтернативные почтовые адреса
|
|
|
|
|
modAttrs = []
|
|
|
|
@ -3782,7 +3804,7 @@ Unix service ...") %str(primaryMail))
|
|
|
|
|
if not flagError and servReplObj:
|
|
|
|
|
if not servReplObj.addReplMailAlias(userName, altMails):
|
|
|
|
|
self.printERROR(_("Failed set mail aliases \
|
|
|
|
|
for user %s in 'Replicatinon/Mail' branch ...") %userName)
|
|
|
|
|
for user %s in 'Replication/Mail' branch ...") %userName)
|
|
|
|
|
flagError = True
|
|
|
|
|
if not flagError and removeMailDirBack\
|
|
|
|
|
and os.path.exists(removeMailDirBack):
|
|
|
|
@ -7126,6 +7148,12 @@ to this group (comma delimited)")
|
|
|
|
|
'helpChapter':_("Mail service options"),
|
|
|
|
|
'help':_("host names mail servers who have no access to email \
|
|
|
|
|
to this group (comma delimited)")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(2,),
|
|
|
|
|
'longOption':"hide-off",
|
|
|
|
|
'helpChapter':_("Mail service options"),
|
|
|
|
|
'help':_("clear host names mail servers who have no access to email \
|
|
|
|
|
to this group")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(2,),
|
|
|
|
|
'shortOption':"e",
|
|
|
|
@ -9225,6 +9253,21 @@ if %%errorlevel%%==0 NET USE T: \\\\%s\\ftp' %(netbios,netbios,netbios)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@adminConnectLdap
|
|
|
|
|
def deleteHideHosts(self, aliasName):
|
|
|
|
|
"""Удаляет свойство алиаса фильтр хостов"""
|
|
|
|
|
rez = self.searchMailAlias(aliasName)
|
|
|
|
|
if not rez:
|
|
|
|
|
return True
|
|
|
|
|
if rez[0][0][1].has_key('filtersender'):
|
|
|
|
|
attrDelete = []
|
|
|
|
|
relMailDN = self.getRelMailDN()
|
|
|
|
|
aliasDN = self.addDN("cn=%s"%aliasName, relMailDN)
|
|
|
|
|
attrDelete.append((ldap.MOD_DELETE, 'filtersender', None))
|
|
|
|
|
if not self.modAttrsDN(aliasDN, attrDelete):
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@adminConnectLdap
|
|
|
|
|
def modReplMailAlias(self, userName, srcMails, filterHosts=[]):
|
|
|
|
|
"""Изменяем запись в Replication/Mail
|
|
|
|
|