Skip to content

Commit 9d33314

Browse files
refactor: move adding installed app when apps are ready
1 parent 9369855 commit 9d33314

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

openedx_authz/apps.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
from django.apps import AppConfig
6+
from django.conf import settings
67

78
from openedx_authz.engine.enforcer import AuthzEnforcer
89

@@ -45,4 +46,7 @@ class OpenedxAuthzConfig(AppConfig):
4546
def ready(self):
4647
"""Initialization layer for the openedx_authz app."""
4748
# Initialize the enforcer to ensure it's ready when the app starts
49+
casbin_adapter_app = "casbin_adapter.apps.CasbinAdapterConfig"
50+
if casbin_adapter_app not in settings.INSTALLED_APPS:
51+
settings.INSTALLED_APPS.append(casbin_adapter_app)
4852
AuthzEnforcer()

openedx_authz/settings/common.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ def plugin_settings(settings):
1717
settings: The Django settings object
1818
"""
1919
# Add external third-party apps to INSTALLED_APPS
20-
casbin_adapter_app = "casbin_adapter.apps.CasbinAdapterConfig"
21-
if casbin_adapter_app not in settings.INSTALLED_APPS:
22-
settings.INSTALLED_APPS.append(casbin_adapter_app)
2320

2421
# Add Casbin configuration
2522
settings.CASBIN_MODEL = os.path.join(

0 commit comments

Comments
 (0)