mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 23:13:00 +00:00
Removed database calls and made scope filter a callable
This commit is contained in:
@@ -38,10 +38,8 @@ class GroupListAPIHandler(_GroupAPIHandler):
|
||||
def get(self):
|
||||
"""List groups"""
|
||||
groups = self.db.query(orm.Group)
|
||||
scope_filter = self.get_scope_filter(self.db)
|
||||
if scope_filter is not None:
|
||||
groups = groups.filter(orm.Group.name.in_(scope_filter))
|
||||
data = [self.group_model(g) for g in groups]
|
||||
scope_filter = self.get_scope_filter('read:groups')
|
||||
data = [self.group_model(g) for g in groups if scope_filter(g)]
|
||||
self.write(json.dumps(data))
|
||||
|
||||
@needs_scope('admin:groups')
|
||||
|
Reference in New Issue
Block a user