Skip to content

Commit

Permalink
temporarily allow organization_list_for_user until bug in CKAN core i…
Browse files Browse the repository at this point in the history
…s fixed

(ckan/ckan#7109)
  • Loading branch information
knudmoeller committed Oct 10, 2022
1 parent 3f2eb4c commit f1ba009
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ckanext/berlinauth/auth/get.py
Expand Up @@ -30,11 +30,11 @@ def member_roles_list(context, data_dict):
}


@plugins.toolkit.auth_disallow_anonymous_access
@plugins.toolkit.auth_allow_anonymous_access
def organization_list_for_user(context, data_dict):
"""Implementation of ckan.logic.auth.get.organization_list_for_user
- anonymous: disallow
- anonymous: disallow (TODO: temporarily allowed because of CKAN core's missing auth_user_obj bug)
- all others: standard behaviour
"""
return ckanget.organization_list_for_user(context, data_dict)
Expand Down
13 changes: 9 additions & 4 deletions ckanext/berlinauth/tests/test_action_get.py
Expand Up @@ -38,7 +38,6 @@ def org_with_users(app, sysadmin):
extra_environ={'Authorization': sysadmin['apikey']},
)

for role, user in users.items():
member = {
'username': user['name'],
'role': role,
Expand Down Expand Up @@ -88,7 +87,9 @@ def test_technical_group_excluded_for_anonymous(self, app):
result = data['result']
assert technical_name not in [org['name'] for org in result]

@pytest.mark.skip(reason="doesn't work due to bug in CKAN core")
# TODO: skip the following because of CKAN core's missing auth_user_obj bug:
# not currently skipped because we temporarily allow organization_list_for_user for anonymous while this bug isn't fixed
# @pytest.mark.skip(reason="doesn't work due to bug in CKAN core")
def test_technical_group_excluded_for_regular(self, app):
'''Test that organizations specified as 'technical' are not returned by
`organization_list` for regular logged-in users.'''
Expand Down Expand Up @@ -147,7 +148,9 @@ def test_sysadmin_can_see_all_members(self, app, org_with_users, group_type):
# also return the site_user
assert set(expected_names).issubset(set(member_names))

@pytest.mark.skip(reason="doesn't work due to bug in CKAN core")
# TODO: skip the following because of CKAN core's missing auth_user_obj bug:
# not currently skipped because we temporarily allow organization_list_for_user for anonymous while this bug isn't fixed
# @pytest.mark.skip(reason="doesn't work due to bug in CKAN core")
def test_org_admin_can_see_all_users(self, app, org_with_users):
'''Check that an org's admin can see all of its members.'''

Expand All @@ -166,7 +169,9 @@ def test_org_admin_can_see_all_users(self, app, org_with_users):
# also return the site_user
assert set(expected_names).issubset(set(member_names))

@pytest.mark.skip(reason="doesn't work due to bug in CKAN core")
# TODO: skip the following because of CKAN core's missing auth_user_obj bug:
# not currently skipped because we temporarily allow organization_list_for_user for anonymous while this bug isn't fixed
# @pytest.mark.skip(reason="doesn't work due to bug in CKAN core")
def test_regular_member_can_only_see_self(self, app, org_with_users):
'''Check that a regular org member can only see themselves as a member.'''

Expand Down

0 comments on commit f1ba009

Please sign in to comment.