Skip to content

enh: use dcor_group_list_for_user for listing user collections - #122

Merged
paulmueller merged 1 commit into
DCOR-dev:mainfrom
paulmueller-agent:feat-group-list-for-user
Oct 23, 2026
Merged

paulmueller merged 1 commit into
DCOR-dev:mainfrom
paulmueller-agent:feat-group-list-for-user

Conversation

@paulmueller-agent

Copy link
Copy Markdown
Contributor

Closes #108. Client side of DCOR-dev/ckanext-dcor_schemas#41 (merged).

Changes

APIInterrogator.get_collections_user() (used for "shared with me" datasets and cached by CachedAPIInterrogator):

  • First calls the new API action dcor_group_list_for_user, which returns the user's collections in any capacity in one request.
  • Fallback: if the server answers APIBadRequest with "Action name not known" (servers without ckanext-dcor_schemas 1.2.0), it logs an INFO message and falls back to the previous behaviour: page through all collections and check member_list for each one.
  • Any other APIBadRequest is raised as before, so real errors don't silently trigger the slow path.
  • Anonymous users still get [] without any request.

The action returns the same collection dictionaries (via group_list_dictize) as group_list with all_fields=True, which the fallback returns.

Tests

  • tests/test_dbmodel_api_lists.py (offline, mocked API):
    • test_get_collections_user: the server supports the action, so only one request is made
    • test_get_collections_user_fallback: the server answers "Action name not known", so it falls back to member_list for all 40 collections and gives the same result
    • test_get_collections_user_other_bad_request: other bad requests are raised
  • Against dcor-dev, which does not have the action deployed yet (it currently answers "Action name not known"), the collection and "shared" tests in test_dbmodel_api.py and test_dbmodel_api_cache.py pass via the fallback (6 passed). Once dcor-dev runs ckanext-dcor_schemas master, the same tests exercise the new action.

#121 also adds a CHANGELOG line; whichever of the two is merged second needs a trivial rebase.

🤖 Generated with Claude Code

`APIInterrogator.get_collections_user` now uses the new API action
`dcor_group_list_for_user` (ckanext-dcor_schemas >= 1.2.0), which
returns the collections a user is a member of in a single request. If
the server does not know the action, DCOR-Aid falls back to checking
the members of all collections (one request per collection). Closes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulmueller
paulmueller merged commit bae8470 into DCOR-dev:main Oct 23, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server-side API action to list collections a user is a member of

2 participants