modified view_cert method

master3.3
Спиридонов Денис 12 years ago
parent 59ea952902
commit 104168c4c0

@ -479,65 +479,80 @@ class Basic (DefinitionBase) :
if not find_flag:
self.printSUCCESS(message = \
_("Certificate %d can run all methods!") %cert_id)
return True
results = []
if not os.path.exists (self.group_rights):
open(self.group_rights, 'w')
with open(self.group_rights) as fd:
t = fd.read()
for line in t.splitlines():
words = line.split()
# first word in line equal name input method
if words[0] in groups_list:
methods = words[1].split(',')
for i in methods:
results.append(i.strip())
results = uniq(results)
add_list_rights = []
del_list_rights = []
with open(self.rights) as fr:
t = fr.read()
for line in t.splitlines():
words = line.split()
meth = words[0]
for word in words:
try:
word = int(word)
except:
continue
# compare with certificat number
if cert_id == word:
# if has right
add_list_rights.append(meth)
if cert_id == -word:
del_list_rights.append(meth)
results += add_list_rights
results = uniq(results)
for method in results:
if method in del_list_rights:
results.remove(method)
if results == []:
results.append("No Methods")
else:
results = []
if not os.path.exists (self.group_rights):
open(self.group_rights, 'w')
with open(self.group_rights) as fd:
t = fd.read()
for line in t.splitlines():
words = line.split()
# first word in line equal name input method
if words[0] in groups_list:
methods = words[1].split(',')
for i in methods:
results.append(i.strip())
self.printSUCCESS(message = _("Certificate %d can run: ") %cert_id)
for i in results:
self.printSUCCESS(message = i)
results = uniq(results)
add_list_rights = []
del_list_rights = []
with open(self.rights) as fr:
t = fr.read()
for line in t.splitlines():
words = line.split()
meth = words[0]
for word in words:
try:
word = int(word)
except:
continue
# compare with certificat number
if cert_id == word:
# if has right
add_list_rights.append(meth)
if cert_id == -word:
del_list_rights.append(meth)
results += add_list_rights
results = uniq(results)
for method in results:
if method in del_list_rights:
results.remove(method)
if results == []:
results.append("No Methods")
self.printSUCCESS(message = _("Certificate %d can run: ") %cert_id)
for i in results:
self.printSUCCESS(message = i)
b = '<b>'
_b = '</b>'
self.printSUCCESS(message = b+_('Certificate groups:')+_b+'\n' + \
reduce (lambda x, y: x + '\n' + y, groups_list))
self.printSUCCESS(message = b+_("Fingerprint = ") +_b+\
certobj.digest('SHA1'))
self.printSUCCESS(message = b+_("Serial Number = </b>") +_b +\
str(certobj.get_serial_number()))
self.printSUCCESS(message = ' ')
Issuer = certobj.get_issuer().get_components()
self.printSUCCESS (message = b+_("\nIssuer") +_b)
for i in Issuer:
self.printSUCCESS (message = "%s : %s" %(i[0], i[1]))
Subject = certobj.get_subject().get_components()
self.printSUCCESS (message = b+_("\nSubject") +_b)
for item in Subject:
self.printSUCCESS (message = "%s : %s" %(item[0], item[1]))
return True
#return results
# Обработка сигнала прерывания работы процесса
except KeyboardInterrupt:
# Необходимо передать Fasle для сохранения данных о процессе
return False
except:
return False
#except:
#return False
@rpc(Integer, ViewCert, _returns = Array(ReturnedMessage))
@Dec.check_permissions(["view_cert"])

@ -121,6 +121,8 @@ def serv_get_client_cert (req_id, request, data_path, client_certbase, \
flag = 0
# and each word in line
words = line.split()
if not words:
continue
if words[0] == req_id:
try:
curThread = threading.currentThread()

@ -120,6 +120,8 @@ class ApiWsdl:
body.append([str(i),username,ip,mac,date,location,group])
i+=1
if not body:
body.append(['','','','','','',''])
self.printTable(head, body, "Request Table", fields = fields, \
onClick = 'detail_request')
self.endTask()

@ -427,10 +427,6 @@ class ApiWsdl:
#opt = Option(longopt="--bot",
#metavalue="BOT"),
#element = "button"))
view.groups.append(group)
#print view
return view
elif step == 1:
view = ViewInfo(groups=[])

Loading…
Cancel
Save