From dd7077ba5f803396b1270a4953a80f612f6769f0 Mon Sep 17 00:00:00 2001 From: Gurman Deep Singh Date: Thu, 9 Jan 2025 12:29:58 -0800 Subject: [PATCH 1/2] Get all orgs instead of getting only those where user has editor permissions --- ckanext/bcgov/util/helpers.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ckanext/bcgov/util/helpers.py b/ckanext/bcgov/util/helpers.py index 5c8f482e..e5aff53c 100644 --- a/ckanext/bcgov/util/helpers.py +++ b/ckanext/bcgov/util/helpers.py @@ -366,12 +366,13 @@ 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, 'user': c.user, 'auth_user_obj': c.userobj} + data_dict = { + 'is_organization': 'True', + 'all_fields': 'True' + } + all_orgs_data = get_action('organization_or_group_list_related')(context, data_dict) + orgs = [{'value': org['id'], 'label': org['display_name']} for org in all_orgs_data] return orgs From d7995df1cee4732072f2d6c813a516001cbaaeea Mon Sep 17 00:00:00 2001 From: Gurman Deep Singh Date: Thu, 9 Jan 2025 12:34:09 -0800 Subject: [PATCH 2/2] Removing session explicitly causes helper function to fail --- ckanext/bcgov/logic/action.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/bcgov/logic/action.py b/ckanext/bcgov/logic/action.py index 0da9a802..dc18cc28 100644 --- a/ckanext/bcgov/logic/action.py +++ b/ckanext/bcgov/logic/action.py @@ -705,7 +705,7 @@ def organization_or_group_list_related(context, data_dict): g1.approval_status = 'approved'; """) - model.Session.remove() + # model.Session.remove() # groups and oganizations are listed as groups in database all_groups = {}