Skip to content

Commit

Permalink
[#2939] Update group/org list action
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Sep 27, 2012
1 parent bffa110 commit e482f5a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ckan/logic/action/get.py
Expand Up @@ -279,7 +279,7 @@ def type_lookup(name):
return [ (m.table_id, type_lookup(m.table_name) ,m.capacity,)
for m in q.all() ]

def _group_or_org_list(context, data_dict):
def _group_or_org_list(context, data_dict, is_org=False):

model = context['model']
api = context.get('api_version')
Expand Down Expand Up @@ -312,7 +312,7 @@ def _group_or_org_list(context, data_dict):
if groups:
query = query.filter(model.GroupRevision.name.in_(groups))

if data_dict['type'] == 'organization':
if is_org:
query = query.filter(model.GroupRevision.type=='organization')
else:
query = query.filter(model.GroupRevision.type!='organization')
Expand Down Expand Up @@ -374,9 +374,9 @@ def organization_list(context, data_dict):
'''
_check_access('organization_list', context, data_dict)
data_dict['groups'] = data_dict.get('organizations')
data_dict['groups'] = data_dict.pop('organizations', [])
data_dict['type'] = 'organization'
return _group_or_org_list(context, data_dict)
return _group_or_org_list(context, data_dict, is_org=True)


def group_list_authz(context, data_dict):
Expand Down

0 comments on commit e482f5a

Please sign in to comment.