-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcommon.py
More file actions
35 lines (28 loc) · 1.2 KB
/
common.py
File metadata and controls
35 lines (28 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Common settings for openedx_authz plugin.
"""
import os
from openedx_authz import ROOT_DIRECTORY
def plugin_settings(settings):
"""
Configure plugin settings for Open edX.
This function is called by the Open edX plugin system to configure
the Django settings for this plugin.
Args:
settings: The Django settings object
"""
# Add external third-party apps to INSTALLED_APPS
casbin_adapter_app = "casbin_adapter.apps.CasbinAdapterConfig"
if casbin_adapter_app not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS.append(casbin_adapter_app)
# Add Casbin configuration
settings.CASBIN_MODEL = os.path.join(ROOT_DIRECTORY, "engine", "config", "model.conf")
settings.CASBIN_WATCHER_ENABLED = True
# TODO: Replace with a more dynamic configuration
# Redis host and port are temporarily loaded here for the MVP
settings.REDIS_HOST = "redis"
settings.REDIS_PORT = 6379
# TODO: Set to True when we have a CONF model that supports filtered policy loading meaningfully
# to avoid partial policy loads and inconsistent states.
# See comments in api/decorators.py for more details.
settings.ALLOW_FILTERED_POLICY_LOADING = False