File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from django .apps import AppConfig
2+ from django .conf import settings
3+ from django .core .exceptions import ImproperlyConfigured
4+
5+
6+ class CasbinAdapterConfig (AppConfig ):
7+ name = "casbin_adapter"
8+
9+ def ready (self ):
10+ """Initialization layer for the casbin_adapter app."""
11+
12+ try :
13+ from casbin_adapter .enforcer import initialize_enforcer
14+
15+ db_alias = getattr (settings , "CASBIN_DB_ALIAS" , "default" )
16+ initialize_enforcer (db_alias )
17+ except ImproperlyConfigured :
18+ # The app might not be fully configured yet (e.g., during migrations).
19+ # In such cases, we skip the enforcer initialization.
20+ pass
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ 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"
20+ casbin_adapter_app = "openedx_authz.engine .apps.CasbinAdapterConfig"
2121 if casbin_adapter_app not in settings .INSTALLED_APPS :
2222 settings .INSTALLED_APPS .append (casbin_adapter_app )
2323 # Add Casbin configuration
You can’t perform that action at this time.
0 commit comments