Skip to content

Commit

Permalink
[#2939] New Authz add is_authorized_boolean() helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Oct 10, 2012
1 parent 83cadc9 commit ac1b1b6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckan/new_authz.py
Expand Up @@ -39,6 +39,12 @@ def get_group_or_org_admin_ids(group_id):
.filter(model.Member.capacity == 'admin')
return [a.table_id for a in q.all()]

def is_authorized_boolean(action, context, data_dict=None):
''' runs the auth function but just returns True if allowed else False
'''
outcome = is_authorized(action, context, data_dict=data_dict)
return outcome.get('success', False)

def is_authorized(action, context, data_dict=None):
if context.get('ignore_auth'):
return {'success': True}
Expand Down

0 comments on commit ac1b1b6

Please sign in to comment.