-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
Description
When we add from openedx_authz.engine.matcher import is_admin_or_superuser_check in openedx_authz/engine/enforcer.py, we create a circular import issue: enforcer → matcher → api → permissions → enforcer, so when I tried to run ./manage lms load_policy or from openedx_authz.engine.enforcer import AuthzEnforcer in the shell, I get:
from openedx_authz.engine.enforcer import AuthzEnforcer
File "/openedx/openedx-authz/openedx_authz/engine/enforcer.py", line 25, in <module>
from openedx_authz.engine.matcher import is_admin_or_superuser_check
File "/openedx/openedx-authz/openedx_authz/engine/matcher.py", line 5, in <module>
from openedx_authz.api.data import ContentLibraryData, ScopeData, UserData
File "/openedx/openedx-authz/openedx_authz/api/__init__.py", line 9, in <module>
from openedx_authz.api.permissions import *
File "/openedx/openedx-authz/openedx_authz/api/permissions.py", line 9, in <module>
from openedx_authz.engine.enforcer import AuthzEnforcer
ImportError: cannot import name 'AuthzEnforcer' from partially initialized module 'openedx_authz.engine.enforcer' (most likely due to a circular import) (/openedx/openedx-authz/openedx_authz/engine/enforcer.py)
How to reproduce the error
Running Load Policy:
- Use the last version of
openedx-authzand try to run./manage lms load_policy. - Get an import error.
Simpler:
- Enter shell
./manage lms shell - Import AuthzEnforcer
from openedx_authz.engine.enforcer import AuthzEnforcer
Remotly:
With the #143 I add a test, and without the fix it fail:
You can also see it failing here: https://github.com/eduNEXT/openedx-authz/actions/runs/19317767166/job/55252613927?pr=2
Expected behavior
Be able to run the ./manage lms load_policy withouth problems.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels