plone / plone/plone.api

erroneous get_permissions() UserNotFoundError

Open
#292 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
101
Forks
62
Avg merge
15h 15m
Merged PRs (30d)
1

Description

With plone.app.testing 4.2.5 you can look up test_user_1_ roles but when you look up its permissions you get UserNotFoundError, even if you specify an object context:

(Pdb) api.user.get_roles(username='test_user_1_')
['Manager', 'Authenticated']
(Pdb) api.user.get_permissions(username='test_user_1_')
*** UserNotFoundError:
(Pdb) api.user.get_permissions(username='test_user_1_', obj=submission)
*** UserNotFoundError:

The user definitely exists:

(Pdb) api.user.get_users()
[<MemberData at /plone/portal_memberdata/test_user_1_ used for /plone/acl_users>]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the discrepancy between api.user.get_roles(), api.user.get_permissions(), and api.user.get_users() for test_user_1_, both with and without the submission object context. Trace the permission lookup entry point and compare it with the working role lookup; done means get_permissions() recognizes the existing user and returns its permissions in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.