Closes #144
This commit is contained in:
parent
07ec04ddc6
commit
1c6e9caa40
|
@ -17,6 +17,7 @@ from lemur.certificates.models import Certificate
|
||||||
from lemur.destinations.models import Destination
|
from lemur.destinations.models import Destination
|
||||||
from lemur.notifications.models import Notification
|
from lemur.notifications.models import Notification
|
||||||
from lemur.authorities.models import Authority
|
from lemur.authorities.models import Authority
|
||||||
|
from lemur.domains.models import Domain
|
||||||
|
|
||||||
from lemur.roles.models import Role
|
from lemur.roles.models import Role
|
||||||
|
|
||||||
|
@ -271,6 +272,7 @@ def render(args):
|
||||||
|
|
||||||
if filt:
|
if filt:
|
||||||
terms = filt.split(';')
|
terms = filt.split(';')
|
||||||
|
|
||||||
if 'issuer' in terms:
|
if 'issuer' in terms:
|
||||||
# we can't rely on issuer being correct in the cert directly so we combine queries
|
# we can't rely on issuer being correct in the cert directly so we combine queries
|
||||||
sub_query = database.session_query(Authority.id)\
|
sub_query = database.session_query(Authority.id)\
|
||||||
|
@ -285,10 +287,17 @@ def render(args):
|
||||||
)
|
)
|
||||||
return database.sort_and_page(query, Certificate, args)
|
return database.sort_and_page(query, Certificate, args)
|
||||||
|
|
||||||
if 'destination' in terms:
|
elif 'destination' in terms:
|
||||||
query = query.filter(Certificate.destinations.any(Destination.id == terms[1]))
|
query = query.filter(Certificate.destinations.any(Destination.id == terms[1]))
|
||||||
elif 'active' in filt: # this is really weird but strcmp seems to not work here??
|
elif 'active' in filt: # this is really weird but strcmp seems to not work here??
|
||||||
query = query.filter(Certificate.active == terms[1])
|
query = query.filter(Certificate.active == terms[1])
|
||||||
|
elif 'cn' in terms:
|
||||||
|
query = query.filter(
|
||||||
|
or_(
|
||||||
|
Certificate.cn.ilike('%{0}%'.format(terms[1])),
|
||||||
|
Certificate.domains.any(Domain.name.ilike('%{0}%'.format(terms[1])))
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
query = database.filter(query, Certificate, terms)
|
query = database.filter(query, Certificate, terms)
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<td data-title="'Issuer'" sortable="'issuer'" filter="{ 'issuer': 'text' }">
|
<td data-title="'Issuer'" sortable="'issuer'" filter="{ 'issuer': 'text' }">
|
||||||
{{ ::certificate.authority.name || certificate.issuer }}
|
{{ ::certificate.authority.name || certificate.issuer }}
|
||||||
</td>
|
</td>
|
||||||
<td data-title="'Common Name'" filter="{ 'cn': 'text'}">
|
<td data-title="'Domains'" filter="{ 'cn': 'text'}">
|
||||||
{{ ::certificate.cn }}
|
{{ ::certificate.cn }}
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-2" data-title="''">
|
<td class="col-md-2" data-title="''">
|
||||||
|
|
Loading…
Reference in New Issue