|
|
|
@ -110,13 +110,45 @@ class report():
|
|
|
|
|
listStrSep = []
|
|
|
|
|
for lenCol in self.columnsWidth:
|
|
|
|
|
listStrSep.append("-"*lenCol)
|
|
|
|
|
print cl_utils.columnStr(*self.createFormatStr(listStrSep)),
|
|
|
|
|
print cl_utils.columnStr(*self.createFormatStr(self.headerList)),
|
|
|
|
|
print cl_utils.columnStr(*self.createFormatStr(listStrSep)),
|
|
|
|
|
printData = ""
|
|
|
|
|
printData += cl_utils.columnStr(*self.createFormatStr(listStrSep))
|
|
|
|
|
printData += cl_utils.columnStr(*self.createFormatStr(self.headerList))
|
|
|
|
|
printData += cl_utils.columnStr(*self.createFormatStr(listStrSep))
|
|
|
|
|
for s in self.dataList:
|
|
|
|
|
print cl_utils.columnStr(*self.createFormatStr(s)),
|
|
|
|
|
print cl_utils.columnStr(*self.createFormatStr(listStrSep)),
|
|
|
|
|
printData += cl_utils.columnStr(*self.createFormatStr(s))
|
|
|
|
|
printData += cl_utils.columnStr(*self.createFormatStr(listStrSep))
|
|
|
|
|
if printData[-1] == "\n":
|
|
|
|
|
printData = printData[:-1]
|
|
|
|
|
lines = printData.splitlines()
|
|
|
|
|
lenCols = map(lambda x: len(x), lines[0].strip().split(" "))
|
|
|
|
|
convLines = []
|
|
|
|
|
lenLines = len(lines)
|
|
|
|
|
for i in range(lenLines):
|
|
|
|
|
char = " | "
|
|
|
|
|
if i == 0 or i == 2 or i == lenLines-1:
|
|
|
|
|
char ="-+-"
|
|
|
|
|
convLines.append(self._insertStrChar(lines[i], lenCols, char))
|
|
|
|
|
print "\n".join(convLines)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def _insertStrChar(self, line, lenCols, char):
|
|
|
|
|
"""Вставляет несколько символов char в указанные позиции
|
|
|
|
|
|
|
|
|
|
сначала строки будет вставлено char[1:] в конце строки char[:-1]
|
|
|
|
|
"""
|
|
|
|
|
prevPos = 0
|
|
|
|
|
convLine = char[1:]
|
|
|
|
|
lenLenCols = len(lenCols)
|
|
|
|
|
for i in range(lenLenCols):
|
|
|
|
|
pos = lenCols[i] + prevPos
|
|
|
|
|
if i == lenLenCols-1:
|
|
|
|
|
insertChar = char[:-1]
|
|
|
|
|
else:
|
|
|
|
|
insertChar = char
|
|
|
|
|
convLine += line[prevPos:pos] + insertChar
|
|
|
|
|
prevPos = pos + 1
|
|
|
|
|
return convLine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def adminConnectLdap(fun):
|
|
|
|
|
"""Cоединение с LDAP администратором сервиса (декоратор)
|
|
|
|
@ -4975,6 +5007,9 @@ class servSamba(shareLdap):
|
|
|
|
|
relCsDN = 'ou=Computers'
|
|
|
|
|
relServDN = 'ou=Samba'
|
|
|
|
|
ldifFileBase = "/usr/lib/calculate/calculate-server/ldif/samba_base.ldif"
|
|
|
|
|
# Файл для определения к какому из серверов
|
|
|
|
|
# подключился клиент в случае включения репликации
|
|
|
|
|
shareReplFile = ".reprun"
|
|
|
|
|
|
|
|
|
|
def __init__(self, unixObj=False):
|
|
|
|
|
shareLdap.__init__(self)
|
|
|
|
@ -4992,6 +5027,34 @@ class servSamba(shareLdap):
|
|
|
|
|
# создаем объект сервиса Unix
|
|
|
|
|
self.servUnixObj = servUnix(self)
|
|
|
|
|
|
|
|
|
|
def delReplFile(self, clVars):
|
|
|
|
|
"""Удаляем файл из директории share в случае отключения репликации"""
|
|
|
|
|
# Файл для определения к какому из серверов
|
|
|
|
|
# подключился клиент
|
|
|
|
|
fileReplRun = os.path.join(clVars.Get("sr_samba_share_path"),
|
|
|
|
|
self.shareReplFile)
|
|
|
|
|
if os.path.exists(fileReplRun):
|
|
|
|
|
try:
|
|
|
|
|
os.remove(fileReplRun)
|
|
|
|
|
except:
|
|
|
|
|
self.printERROR(_("Can not remove %s")%fileReplRun)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def addReplFile(self, clVars):
|
|
|
|
|
"""Добавляем файл в директорию share в случае влючения репликации"""
|
|
|
|
|
fileReplRun = os.path.join(clVars.Get("sr_samba_share_path"),
|
|
|
|
|
self.shareReplFile)
|
|
|
|
|
if not os.path.exists(fileReplRun):
|
|
|
|
|
# Создаем файл
|
|
|
|
|
# Текст внутри файла
|
|
|
|
|
warning = _("Please do not remove the file, it was added by \
|
|
|
|
|
the calculate-server")
|
|
|
|
|
if not self.createUserFile(fileReplRun,warning,0,0,
|
|
|
|
|
mode=0644):
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def getLdapObjInFile(self):
|
|
|
|
|
"""Cоединение с LDAP администратором Samba сервиса"""
|
|
|
|
|
return shareLdap.getLdapObjInFile(self, "samba")
|
|
|
|
@ -5469,6 +5532,9 @@ if %%errorlevel%%==0 NET USE T: \\\\%s\\ftp' %(netbios,netbios,netbios)
|
|
|
|
|
# Удаляем из автозапуска демона
|
|
|
|
|
if not self.delDaemonAutostart("samba"):
|
|
|
|
|
return False
|
|
|
|
|
# Удаляем из share файл .replrun
|
|
|
|
|
if not self.delReplFile(self.clVars):
|
|
|
|
|
return False
|
|
|
|
|
# останавливаем сервис Samba
|
|
|
|
|
if not self.stopServices(["samba"]):
|
|
|
|
|
return False
|
|
|
|
@ -6113,18 +6179,15 @@ outdated. If the backup is obsolete, use cl-backup."))
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
if self.clVars.Get("ld_repl_samba_set") == "on":
|
|
|
|
|
if not os.path.exists(fileReplRun):
|
|
|
|
|
# Создаем файл
|
|
|
|
|
# Текст внутри файла
|
|
|
|
|
warning = _("Please do not remove the file, \
|
|
|
|
|
it was added by the calculate-server")
|
|
|
|
|
if not self.createUserFile(fileReplRun,warning,0,0,
|
|
|
|
|
mode=0644):
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
# Добавляем в share файл .reprun
|
|
|
|
|
if not self.servSambaObj.addReplFile(self.clVars):
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
else:
|
|
|
|
|
if os.path.exists(fileReplRun):
|
|
|
|
|
os.remove(fileReplRun)
|
|
|
|
|
# Удаляем из share файл .reprun
|
|
|
|
|
if not self.servSambaObj.delReplFile(self.clVars):
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
if service == "mail":
|
|
|
|
|
# Получаем от пользователя доверительные сети
|
|
|
|
|
# для сервиса Mail
|
|
|
|
@ -7091,6 +7154,9 @@ for running replication")%bFile)
|
|
|
|
|
objRepl = servRepl()
|
|
|
|
|
if not objRepl.cronReplicationOFF():
|
|
|
|
|
return False
|
|
|
|
|
# Удаляем из share файл .replrun
|
|
|
|
|
if not self.servSambaObj.delReplFile(self.clVars):
|
|
|
|
|
return False
|
|
|
|
|
# Получим пути к ini файлам
|
|
|
|
|
iniFiles = self.clVars.Get("cl_env_path")
|
|
|
|
|
# Удаляем все ini файлы
|
|
|
|
@ -8131,10 +8197,33 @@ the password will be changed only for Samba account")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(14,),
|
|
|
|
|
'shortOption':"u",
|
|
|
|
|
'optVal':"CONDITION",
|
|
|
|
|
'longOption':"user",
|
|
|
|
|
'helpChapter':_("Common options"),
|
|
|
|
|
'help':_("users") + " or all"
|
|
|
|
|
'help':_("information about users")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(14,),
|
|
|
|
|
'shortOption':"g",
|
|
|
|
|
'helpChapter':_("Common options"),
|
|
|
|
|
'help':_("information about groups")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(14,),
|
|
|
|
|
'longOption':"full",
|
|
|
|
|
'helpChapter':_("Unix service options"),
|
|
|
|
|
'help':_("full information (аll fields)")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(14,),
|
|
|
|
|
'longOption':"full",
|
|
|
|
|
'helpChapter':_("Mail service options"),
|
|
|
|
|
'help':_("full information (аll fields)")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(14,),
|
|
|
|
|
'longOption':"full",
|
|
|
|
|
'helpChapter':_("Jabber service options"),
|
|
|
|
|
'help':_("full information (аll fields)")
|
|
|
|
|
},
|
|
|
|
|
{'progAccess':(14,),
|
|
|
|
|
'longOption':"full",
|
|
|
|
|
'helpChapter':_("FTP service options"),
|
|
|
|
|
'help':_("full information (аll fields)")
|
|
|
|
|
},
|
|
|
|
|
#{'progAccess':(0,1,2,4,5,6),
|
|
|
|
|
#'shortOption':"s",
|
|
|
|
@ -8239,7 +8328,7 @@ the password will be changed only for Samba account")
|
|
|
|
|
" " + _("service")
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'progAccess':(6,12),
|
|
|
|
|
'progAccess':(6,12,14),
|
|
|
|
|
'helpChapter':_("Usage"),
|
|
|
|
|
'help': cmdName + " [" + _("options") + "] "+\
|
|
|
|
|
" " + _("service")
|
|
|
|
@ -10392,21 +10481,41 @@ together with option '-r'") + " ...")
|
|
|
|
|
|
|
|
|
|
class cl_info(cl_utils2.cl_smartcon):
|
|
|
|
|
"""Класс для вывода информации"""
|
|
|
|
|
|
|
|
|
|
def getInfoServer(self, options, service):
|
|
|
|
|
"""Выводит на печать информацию"""
|
|
|
|
|
if options.has_key("u"):
|
|
|
|
|
userOpt = options['u']
|
|
|
|
|
users = []
|
|
|
|
|
if userOpt == "all":
|
|
|
|
|
headerList , users = self.getAllUsers(service)
|
|
|
|
|
title=_("All users in LDAP for service %s")%service.capitalize()
|
|
|
|
|
dataList = users
|
|
|
|
|
#dataList = map(lambda x: type(x) != types.ListType and [x],
|
|
|
|
|
#users)
|
|
|
|
|
repObj = report(title, headerList, dataList)
|
|
|
|
|
repObj.printReport()
|
|
|
|
|
#print users
|
|
|
|
|
return True
|
|
|
|
|
fields = "short"
|
|
|
|
|
if options.has_key("full"):
|
|
|
|
|
fields = "full"
|
|
|
|
|
data = self.getAllUsers(fields, service)
|
|
|
|
|
if not data:
|
|
|
|
|
return False
|
|
|
|
|
headerList, dataList = data
|
|
|
|
|
title=_("All users in LDAP for service %s")%service.capitalize()
|
|
|
|
|
|
|
|
|
|
elif options.has_key("g"):
|
|
|
|
|
data = self.getAllGroups(service)
|
|
|
|
|
if not data:
|
|
|
|
|
return False
|
|
|
|
|
headerList, dataList = data
|
|
|
|
|
title=_("All groups in LDAP for service %s")%service.capitalize()
|
|
|
|
|
|
|
|
|
|
if options.has_key("u") or options.has_key("g"):
|
|
|
|
|
repObj = report(title, headerList, dataList)
|
|
|
|
|
repObj.printReport()
|
|
|
|
|
#print users
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
if len(options) == 1 and options.has_key("full"):
|
|
|
|
|
if service == "unix" and options.has_key("full"):
|
|
|
|
|
self.printERROR(_("Can not use a single command line option \
|
|
|
|
|
'full'."))
|
|
|
|
|
self.printERROR(_("This option should be used in conjunction \
|
|
|
|
|
with another option."))
|
|
|
|
|
self.printWARNING(_("Example"))
|
|
|
|
|
self.printWARNING(" cl-info -u -full unix")
|
|
|
|
|
return False
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def getQueryLDAP(self, service, branch, searchAttr, searchStr,
|
|
|
|
@ -10426,6 +10535,9 @@ class cl_info(cl_utils2.cl_smartcon):
|
|
|
|
|
self.printERROR(\
|
|
|
|
|
_("ERROR: getQueryLDAP incorrect service=%s")%service)
|
|
|
|
|
return False
|
|
|
|
|
# Если сервис не установлен то ошибка
|
|
|
|
|
if not servObj.isServiceSetup(service):
|
|
|
|
|
return False
|
|
|
|
|
if not servObj.__dict__.has_key(relAttr):
|
|
|
|
|
self.printERROR(_("getQueryLDAP service=%s")%service)
|
|
|
|
|
self.printERROR(_("ERROR: getQueryLDAP incorrect branch=%s")%branch)
|
|
|
|
@ -10434,34 +10546,102 @@ class cl_info(cl_utils2.cl_smartcon):
|
|
|
|
|
searchAttr, retrAttrs)
|
|
|
|
|
return searchRes
|
|
|
|
|
|
|
|
|
|
def getAllUsers(self, service):
|
|
|
|
|
def getAllGroups(self, service):
|
|
|
|
|
"""Выдает список всех групп и пользователей"""
|
|
|
|
|
searchAttr = "cn"
|
|
|
|
|
searchStr = "*"
|
|
|
|
|
if service == "unix":
|
|
|
|
|
data = [("GROUP","cn"),
|
|
|
|
|
("NAME","description"),
|
|
|
|
|
("GID","gidNumber"),
|
|
|
|
|
("MEMBER","memberUid")]
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Incorrect service %s") %service.capitalize())
|
|
|
|
|
return False
|
|
|
|
|
headers = map(lambda x: x[0], data)
|
|
|
|
|
retrAttrs = map(lambda x: x[1], data)
|
|
|
|
|
groups = []
|
|
|
|
|
searchRes = self.getQueryLDAP(service, "groups", searchAttr,
|
|
|
|
|
searchStr, retrAttrs)
|
|
|
|
|
if not searchRes:
|
|
|
|
|
return (headers , [])
|
|
|
|
|
for info in searchRes:
|
|
|
|
|
listAttr = []
|
|
|
|
|
for attr in retrAttrs:
|
|
|
|
|
if attr in info[0][1]:
|
|
|
|
|
ldapValue = info[0][1][attr]
|
|
|
|
|
#Если несколько значений то разделяем их запятыми
|
|
|
|
|
value = reduce(lambda x,y: ",".join([x,y])[0] == "," and\
|
|
|
|
|
",".join([x,y])[1:] or ",".join([x,y])[1:]\
|
|
|
|
|
and ",".join([x,y]) , ldapValue, "")
|
|
|
|
|
listAttr.append(value)
|
|
|
|
|
else:
|
|
|
|
|
listAttr.append("N")
|
|
|
|
|
groups.append(listAttr)
|
|
|
|
|
return (headers, groups)
|
|
|
|
|
|
|
|
|
|
def getAllUsers(self, fields, service):
|
|
|
|
|
"""Выдает список login-ов всех пользователей сервиса"""
|
|
|
|
|
searchAttr = "uid"
|
|
|
|
|
searchStr = "*"
|
|
|
|
|
delData = []
|
|
|
|
|
if service == "unix":
|
|
|
|
|
data = [("LOGIN","uid"),
|
|
|
|
|
("NAME","cn"),
|
|
|
|
|
("LOCK","shadowExpire"),
|
|
|
|
|
("VISIBLE","shadowFlag"),
|
|
|
|
|
("UID","uidNumber"),
|
|
|
|
|
("GID","gidNumber"),
|
|
|
|
|
("GROUP","gidNumber"),
|
|
|
|
|
("HOME","homeDirectory"),
|
|
|
|
|
("PWD","userPassword"),
|
|
|
|
|
("DATE_PWD","shadowLastChange"),
|
|
|
|
|
("JID","registeredAddress"),
|
|
|
|
|
("MAIL","mail")]
|
|
|
|
|
if fields == "short":
|
|
|
|
|
delData = ["LOCK","VISIBLE","PWD","DATE_PWD","JID","MAIL"]
|
|
|
|
|
elif service == "samba":
|
|
|
|
|
data = [("LOGIN","uid"),
|
|
|
|
|
("NAME","displayName"),
|
|
|
|
|
("LOCK","sambaAcctFlags"),
|
|
|
|
|
("PWD","sambaNTPassword"),
|
|
|
|
|
("LOCK","accountStatus"),
|
|
|
|
|
("PWD",""),
|
|
|
|
|
("DATE_PWD","sambaPwdLastSet")]
|
|
|
|
|
elif service == "mail":
|
|
|
|
|
data = [("LOGIN","uid"),
|
|
|
|
|
("NAME","cn"),
|
|
|
|
|
("LOCK","accountStatus"),
|
|
|
|
|
("PWD","userPassword"),
|
|
|
|
|
("MAIL","mail"),
|
|
|
|
|
("ALT_MAIL","mailAlternateAddress")]
|
|
|
|
|
if fields == "short":
|
|
|
|
|
delData = ["LOCK", "PWD", "MAIL"]
|
|
|
|
|
elif service == "jabber":
|
|
|
|
|
data = [("LOGIN","uid"),
|
|
|
|
|
("NAME","cn"),
|
|
|
|
|
("LOCK","initials"),
|
|
|
|
|
("PWD","userPassword"),
|
|
|
|
|
("JID","mail")]
|
|
|
|
|
if fields == "short":
|
|
|
|
|
delData = ["LOCK", "PWD"]
|
|
|
|
|
elif service == "ftp":
|
|
|
|
|
data = [("LOGIN","uid"),
|
|
|
|
|
("NAME","cn"),
|
|
|
|
|
("UID","uidNumber"),
|
|
|
|
|
("GROUP","gidNumber"),
|
|
|
|
|
("HOME","homeDirectory"),
|
|
|
|
|
("PWD","userPassword")]
|
|
|
|
|
if fields == "short":
|
|
|
|
|
delData = ["UID", "PWD", "GROUP"]
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Incorrect service %s") %service.capitalize())
|
|
|
|
|
return False
|
|
|
|
|
if fields == "short":
|
|
|
|
|
data = filter(lambda x: not x[0] in delData, data)
|
|
|
|
|
headers = map(lambda x: x[0], data)
|
|
|
|
|
retrAttrs = map(lambda x: x[1], data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loginsUsers = []
|
|
|
|
|
searchRes = self.getQueryLDAP(service, "users", searchAttr, searchStr,
|
|
|
|
|
retrAttrs)
|
|
|
|
|
searchRes = self.getQueryLDAP(service, "users", searchAttr,
|
|
|
|
|
searchStr, retrAttrs)
|
|
|
|
|
if not searchRes:
|
|
|
|
|
return (headers , [])
|
|
|
|
|
for info in searchRes:
|
|
|
|
@ -10473,7 +10653,21 @@ class cl_info(cl_utils2.cl_smartcon):
|
|
|
|
|
if attr == "shadowLastChange" or\
|
|
|
|
|
attr == "sambaPwdLastSet":
|
|
|
|
|
ldapValue[0] = self. _convDatatoStr(ldapValue[0])
|
|
|
|
|
# Находим имя группы
|
|
|
|
|
if attr == "gidNumber" and service in ("unix", "ftp"):
|
|
|
|
|
ldapValue[0] = self._getUserGroupName(ldapValue[0],
|
|
|
|
|
"unix")
|
|
|
|
|
# Ставим Y в случае выставленного флага
|
|
|
|
|
if attr == "initials":
|
|
|
|
|
if ldapValue[0] == "No":
|
|
|
|
|
ldapValue[0] = "Y"
|
|
|
|
|
else:
|
|
|
|
|
ldapValue[0] = "N"
|
|
|
|
|
if attr == "accountStatus":
|
|
|
|
|
if ldapValue[0] == "passive":
|
|
|
|
|
ldapValue[0] = "Y"
|
|
|
|
|
else:
|
|
|
|
|
ldapValue[0] = "N"
|
|
|
|
|
if attr == "shadowExpire":
|
|
|
|
|
if ldapValue[0] == "1":
|
|
|
|
|
ldapValue[0] = "Y"
|
|
|
|
@ -10508,7 +10702,7 @@ class cl_info(cl_utils2.cl_smartcon):
|
|
|
|
|
return (headers, loginsUsers)
|
|
|
|
|
|
|
|
|
|
def _convDatatoStr(self, dataDays):
|
|
|
|
|
"""Конвертирует количество дней с 1970 в строку даты"""
|
|
|
|
|
"""Конвертирует количество дней или секунд с 1970, в строку даты"""
|
|
|
|
|
if dataDays:
|
|
|
|
|
if len(str(dataDays)) <= 6:
|
|
|
|
|
value = long(dataDays)*86400
|
|
|
|
@ -10518,37 +10712,28 @@ class cl_info(cl_utils2.cl_smartcon):
|
|
|
|
|
"0"+str(x)) or str(x), time.localtime(value)[:3]))
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def getLockUsers(self, service):
|
|
|
|
|
"""Выдает список login-ов заблокированных пользователей сервиса"""
|
|
|
|
|
searchAttr = ""
|
|
|
|
|
searchStr = ""
|
|
|
|
|
retrAttrs = ["uid"]
|
|
|
|
|
if service == "unix":
|
|
|
|
|
searchAttr = "shadowExpire"
|
|
|
|
|
searchStr = "1"
|
|
|
|
|
elif service == "samba":
|
|
|
|
|
searchAttr = "sambaAcctFlags"
|
|
|
|
|
searchStr = "[DU ]"
|
|
|
|
|
elif service == "mail":
|
|
|
|
|
searchAttr = "accountStatus"
|
|
|
|
|
searchStr = "passive"
|
|
|
|
|
elif service == "jabber":
|
|
|
|
|
searchAttr = "initials"
|
|
|
|
|
searchStr = "No"
|
|
|
|
|
else:
|
|
|
|
|
def _getUserGroupName(self, userGid, service):
|
|
|
|
|
"""Находит имя группы по ее номеру"""
|
|
|
|
|
try:
|
|
|
|
|
exec ("servObj=serv%s()" %service.capitalize())
|
|
|
|
|
except:
|
|
|
|
|
self.printERROR(\
|
|
|
|
|
_("ERROR: getLockUsers incorrect service=%s")%service)
|
|
|
|
|
_("ERROR: _getUserGroupName incorrect service=%s")%service)
|
|
|
|
|
return False
|
|
|
|
|
if not searchAttr or not searchStr:
|
|
|
|
|
return False
|
|
|
|
|
loginsUsers = []
|
|
|
|
|
searchRes = self.getQueryLDAP(service, "users", searchAttr, searchStr,
|
|
|
|
|
retrAttrs)
|
|
|
|
|
if not searchRes:
|
|
|
|
|
return []
|
|
|
|
|
for info in searchRes:
|
|
|
|
|
loginsUsers.append(info[0][1]['uid'][0])
|
|
|
|
|
return loginsUsers
|
|
|
|
|
if service == "unix":
|
|
|
|
|
userGidNamesLdap = servObj.searchGroupsUnix([userGid], False)
|
|
|
|
|
userGidNamesPasswd = servObj.searchGroupsGroups([userGid], False)
|
|
|
|
|
if userGidNamesPasswd:
|
|
|
|
|
#Имя группы пользователя
|
|
|
|
|
groupName = userGidNamesPasswd[0]
|
|
|
|
|
elif userGidNamesLdap:
|
|
|
|
|
#Имя группы пользователя
|
|
|
|
|
groupName = userGidNamesLdap[0]
|
|
|
|
|
else:
|
|
|
|
|
groupName = "Not found"
|
|
|
|
|
return groupName
|
|
|
|
|
return userGid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class tsOpt(cl_base.opt):
|
|
|
|
|
"""Класс для обработки параметров и вывода help
|
|
|
|
|