service keys: join with approvals
Also fixes a bug where we weren't reassigning the query after adding a WHERE.
This commit is contained in:
parent
93720bd0f4
commit
86df0124c1
1 changed files with 2 additions and 2 deletions
|
@ -111,7 +111,7 @@ def approve_service_key(kid, approver, approval_type):
|
||||||
|
|
||||||
|
|
||||||
def _list_service_keys_query(kid=None, service=None, approved_only=False):
|
def _list_service_keys_query(kid=None, service=None, approved_only=False):
|
||||||
query = ServiceKey.select()
|
query = ServiceKey.select().join(ServiceKeyApproval)
|
||||||
|
|
||||||
if approved_only:
|
if approved_only:
|
||||||
query = query.where(~(ServiceKey.approval >> None))
|
query = query.where(~(ServiceKey.approval >> None))
|
||||||
|
@ -122,7 +122,7 @@ def _list_service_keys_query(kid=None, service=None, approved_only=False):
|
||||||
~(_stale_unapproved_keys_clause(service)))
|
~(_stale_unapproved_keys_clause(service)))
|
||||||
|
|
||||||
if kid is not None:
|
if kid is not None:
|
||||||
query.where(ServiceKey.kid == kid)
|
query = query.where(ServiceKey.kid == kid)
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|
Reference in a new issue