diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a1fc68f33bf..86f00029dd6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,8 +9,13 @@ Changelog v2.6.0 TBA ================= + API changes and deprecations: - * Replace `c.__version__` with new helper `h.ckan_version()` (#3103) + * Replace ``c.__version__`` with new helper ``h.ckan_version()`` (#3103) + * ``organization_list_for_user`` (and the ``h.organizations_available()`` + helper) now return all organizations a user belongs to regardless of + capacity (Admin, Editor or Member), not just the ones where she is an + administrator (#2457) Major: * Private datasets are now included in the default dataset search results (#3191) diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index 449363766e4..3949f8209c5 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -1640,7 +1640,7 @@ def groups_available(am_member=False): @core_helper -def organizations_available(permission='admin'): +def organizations_available(permission='read'): '''Return a list of organizations that the current user has the specified permission for. ''' diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 4294453e06b..9ca5e9d7587 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -622,7 +622,7 @@ def organization_list_for_user(context, data_dict): :param permission: the permission the user has against the returned organizations, for example ``"read"`` or ``"create_dataset"`` - (optional, default: ``"admin"``) + (optional, default: ``"read"``) :type permission: string :returns: list of organizations that the user has the given permission for @@ -643,7 +643,7 @@ def organization_list_for_user(context, data_dict): sysadmin = authz.is_sysadmin(user) orgs_q = model.Session.query(model.Group) \ - .filter(model.Group.is_organization == True) \ + .filter(model.Group.is_organization is True) \ .filter(model.Group.state == 'active') if sysadmin: @@ -651,7 +651,7 @@ def organization_list_for_user(context, data_dict): else: # for non-Sysadmins check they have the required permission - permission = data_dict.get('permission', 'admin') + permission = data_dict.get('permission', 'read') roles = authz.get_roles_with_permission(permission)