diff --git a/ckanext/bcgov/util/helpers.py b/ckanext/bcgov/util/helpers.py index d72998db..ce4435fb 100644 --- a/ckanext/bcgov/util/helpers.py +++ b/ckanext/bcgov/util/helpers.py @@ -17,6 +17,7 @@ import ckanext.bcgov from ckanext.bcgov.version import version from ckanext.bcgov.util.git import get_short_commit_id +from ckanext.bcgov.logic.action import organization_or_group_list_related NotFound = logic.NotFound get_action = logic.get_action @@ -366,12 +367,16 @@ def get_edc_org(org_id): def get_orgs_form(field = None): """Designed to get available orgs for scheming fields as parameters cannot be defined in choices_helper functions""" - orgs = [] - for org in ckan.lib.helpers.organizations_available('create_dataset'): - orgs.append({ - 'value': org['id'], - 'label': org['display_name'] - }) + context = {'model': model, 'session': model.Session, + 'user': c.user, 'auth_user_obj': c.userobj} + data_dict = { + 'is_organization': True, + 'all_fields': True + } + all_orgs_data = (organization_or_group_list_related(context, data_dict)) + + orgs = [{'id': org['id'], 'display_name': org['display_name']} for org in all_orgs_data] + return orgs