Skip to content

Commit

Permalink
[2939] fix so that users can not create dataset if belong to no org
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Nov 13, 2012
1 parent 22389d9 commit d60e11b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ckan/new_authz.py
Expand Up @@ -137,13 +137,15 @@ def has_user_permission_for_some_org(user_name, permission):
group_ids = []
for row in q.all():
group_ids.append(row.group_id)
# if not in any groups has no permissions
if not group_ids:
return False

# see if any of the groups are orgs
q = model.Session.query(model.Group) \
.filter(model.Group.is_organization == True) \
.filter(model.Group.state == 'active')
if group_ids:
q = q.filter(model.Group.id.in_(group_ids))
.filter(model.Group.state == 'active') \
.filter(model.Group.id.in_(group_ids))

return bool(q.count())

Expand Down

0 comments on commit d60e11b

Please sign in to comment.