|
|
|
@ -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"])
|
|
|
|
|