Skip to content

Commit

Permalink
[#2939] New Authz new permission
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Oct 10, 2012
1 parent 79ac573 commit 043202d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ckan/new_authz.py
Expand Up @@ -66,6 +66,17 @@ def is_authorized(action, context, data_dict=None):
'member': [''],
}


def get_roles_with_permission(permission):
''' returns the roles with the permission requested '''
roles = []
for role in ROLE_PERMISSIONS:
permissions = ROLE_PERMISSIONS[role]
if permission in permissions or 'admin' in permissions:
roles.append(role)
return roles


def has_user_permission_for_group_or_org(group_id, user_id, permission):
''' Check if the user has the given permission for the group '''
if not user_id:
Expand Down

0 comments on commit 043202d

Please sign in to comment.