Skip to content

Commit

Permalink
[#2939] New get admins for group_id function added
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Oct 9, 2012
1 parent 606ea35 commit b9c8ed7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckan/new_authz.py
Expand Up @@ -32,6 +32,12 @@ def is_sysadmin(username):
return True
return False

def get_group_or_org_admin_ids(group_id):
q = model.Session.query(model.Member) \
.filter(model.Member.group_id == group_id) \
.filter(model.Member.table_name == 'user') \
.filter(model.Member.capacity == 'admin')
return [a.table_id for a in q.all()]

def is_authorized(action, context, data_dict=None):
if context.get('ignore_auth'):
Expand Down

0 comments on commit b9c8ed7

Please sign in to comment.