Endpoints should be visible to all. (#508)
This commit is contained in:
parent
5345170a4f
commit
a9361fe428
|
@ -8,8 +8,6 @@
|
||||||
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from flask import g
|
|
||||||
|
|
||||||
from lemur import database
|
from lemur import database
|
||||||
from lemur.extensions import metrics
|
from lemur.extensions import metrics
|
||||||
from lemur.endpoints.models import Endpoint, Policy, Cipher
|
from lemur.endpoints.models import Endpoint, Policy, Cipher
|
||||||
|
@ -121,14 +119,6 @@ def render(args):
|
||||||
else:
|
else:
|
||||||
query = database.filter(query, Endpoint, terms)
|
query = database.filter(query, Endpoint, terms)
|
||||||
|
|
||||||
# we make sure that a user can only use an endpoint they either own are are a member of - admins can see all
|
|
||||||
if not g.current_user.is_admin:
|
|
||||||
endpoint_ids = []
|
|
||||||
for role in g.current_user.roles:
|
|
||||||
for endpoint in role.endpoints:
|
|
||||||
endpoint_ids.append(endpoint.id)
|
|
||||||
query = query.filter(Endpoint.id.in_(endpoint_ids))
|
|
||||||
|
|
||||||
return database.sort_and_page(query, Endpoint, args)
|
return database.sort_and_page(query, Endpoint, args)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue