root / snf-astakos-app / astakos / im / settings.py @ af4d8c34
History | View | Annotate | Download (8.8 kB)
1 |
from django.conf import settings |
---|---|
2 |
from synnefo_branding import settings as synnefo_settings |
3 |
from synnefo.lib import parse_base_url |
4 |
from astakos.api.services import astakos_services as vanilla_astakos_services |
5 |
from synnefo.util.keypath import get_path |
6 |
from synnefo.lib import join_urls |
7 |
from synnefo.lib.services import fill_endpoints |
8 |
|
9 |
from copy import deepcopy |
10 |
|
11 |
|
12 |
BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL', |
13 |
'https://accounts.example.synnefo.org')
|
14 |
|
15 |
|
16 |
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL) |
17 |
|
18 |
astakos_services = deepcopy(vanilla_astakos_services) |
19 |
fill_endpoints(astakos_services, BASE_URL) |
20 |
ACCOUNTS_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
|
21 |
VIEWS_PREFIX = get_path(astakos_services, 'astakos_ui.prefix')
|
22 |
KEYSTONE_PREFIX = get_path(astakos_services, 'astakos_identity.prefix')
|
23 |
WEBLOGIN_PREFIX = get_path(astakos_services, 'astakos_weblogin.prefix')
|
24 |
ADMIN_PREFIX = get_path(astakos_services, 'astakos_admin.prefix')
|
25 |
|
26 |
# Set the expiration time of newly created auth tokens
|
27 |
# to be this many hours after their creation time.
|
28 |
AUTH_TOKEN_DURATION = getattr(settings, 'ASTAKOS_AUTH_TOKEN_DURATION', 30 * 24) |
29 |
|
30 |
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4) |
31 |
|
32 |
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', { |
33 |
0: 100, |
34 |
1: 2, |
35 |
2: 0, |
36 |
3: 0, |
37 |
4: 0 |
38 |
}) |
39 |
|
40 |
ADMINS = tuple(getattr(settings, 'ADMINS', ())) |
41 |
MANAGERS = tuple(getattr(settings, 'MANAGERS', ())) |
42 |
HELPDESK = tuple(getattr(settings, 'HELPDESK', ())) |
43 |
|
44 |
CONTACT_EMAIL = settings.CONTACT_EMAIL |
45 |
SERVER_EMAIL = settings.SERVER_EMAIL |
46 |
SECRET_KEY = settings.SECRET_KEY |
47 |
SESSION_ENGINE = settings.SESSION_ENGINE |
48 |
|
49 |
# Identity Management enabled modules
|
50 |
# Supported modules are: 'local', 'twitter' and 'shibboleth'
|
51 |
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local']) |
52 |
|
53 |
# Force user profile verification
|
54 |
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False) |
55 |
|
56 |
#Enable invitations
|
57 |
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False) |
58 |
|
59 |
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a') |
60 |
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None) |
61 |
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True) |
62 |
|
63 |
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/') |
64 |
|
65 |
# If set to False and invitations not enabled newly created user
|
66 |
# will be automatically accepted
|
67 |
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True) |
68 |
|
69 |
# Set service name
|
70 |
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME) |
71 |
|
72 |
# Set recaptcha keys
|
73 |
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '') |
74 |
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '') |
75 |
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS', |
76 |
{'theme': 'custom', |
77 |
'custom_theme_widget': 'okeanos_recaptcha'}) |
78 |
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True) |
79 |
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False) |
80 |
|
81 |
# Set where the user should be redirected after logout
|
82 |
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '') |
83 |
|
84 |
# Set user email patterns that are automatically activated
|
85 |
RE_USER_EMAIL_PATTERNS = getattr(
|
86 |
settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
|
87 |
|
88 |
# Messages to display on login page header
|
89 |
# e.g. {'warning':
|
90 |
# 'This warning message will be displayed on the top of login page'}
|
91 |
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', []) |
92 |
|
93 |
# Messages to display on login page header
|
94 |
# e.g. {'warning':
|
95 |
# 'This warning message will be displayed on the top of signup page'}
|
96 |
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', []) |
97 |
|
98 |
# Messages to display on login page header
|
99 |
# e.g. {'warning':
|
100 |
# 'This warning message will be displayed on the top of profile page'}
|
101 |
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', []) |
102 |
|
103 |
# Messages to display on all pages
|
104 |
# e.g. {'warning':
|
105 |
# 'This warning message will be displayed on the top of every page'}
|
106 |
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', []) |
107 |
|
108 |
# messages to display as extra actions in account forms
|
109 |
# e.g. {'https://www.myhomepage.com': 'Back to <service_name>'}
|
110 |
PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {}) |
111 |
|
112 |
# The number of unsuccessful login requests per minute allowed
|
113 |
# for a specific user
|
114 |
RATELIMIT_RETRIES_ALLOWED = getattr(
|
115 |
settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3) |
116 |
|
117 |
# If False the email change mechanism is disabled
|
118 |
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False) |
119 |
|
120 |
# Set the expiration time (in days) of email change requests
|
121 |
EMAILCHANGE_ACTIVATION_DAYS = getattr(
|
122 |
settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10) |
123 |
|
124 |
# Set the astakos main functions logging severity (None to disable)
|
125 |
from logging import INFO |
126 |
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO) |
127 |
|
128 |
# Set how many objects should be displayed per page
|
129 |
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50) |
130 |
|
131 |
# Set how many objects should be displayed per page in show all projects page
|
132 |
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 50) |
133 |
|
134 |
# Enforce token renewal on password change/reset
|
135 |
NEWPASSWD_INVALIDATE_TOKEN = getattr(
|
136 |
settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True) |
137 |
|
138 |
# Interval at which to update the user's available quota in astakos usage
|
139 |
# profile view
|
140 |
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', |
141 |
5000)
|
142 |
|
143 |
# Permit local account migration
|
144 |
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(
|
145 |
settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True) |
146 |
|
147 |
# Migrate eppn identifiers to remote id
|
148 |
SHIBBOLETH_MIGRATE_EPPN = getattr(settings, 'ASTAKOS_SHIBBOLETH_MIGRATE_EPPN', |
149 |
False)
|
150 |
|
151 |
# Strict shibboleth usage
|
152 |
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
|
153 |
'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
|
154 |
False)
|
155 |
|
156 |
default_activation_redirect_url = join_urls('/', BASE_PATH, VIEWS_PREFIX,
|
157 |
"landing")
|
158 |
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL', |
159 |
default_activation_redirect_url) |
160 |
|
161 |
# If true, this enables a ui compatibility layer for the introduction of UUIDs
|
162 |
# in identity management. WARNING: Setting to True will break your installation
|
163 |
TRANSLATE_UUIDS = getattr(settings, 'ASTAKOS_TRANSLATE_UUIDS', False) |
164 |
|
165 |
# Users that can approve or deny project applications from the web.
|
166 |
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set()) |
167 |
|
168 |
# OAuth2 Twitter credentials.
|
169 |
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '') |
170 |
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '') |
171 |
TWITTER_AUTH_FORCE_LOGIN = getattr(
|
172 |
settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN', False) |
173 |
|
174 |
# OAuth2 Google credentials.
|
175 |
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '') |
176 |
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '') |
177 |
|
178 |
# OAuth2 LinkedIn credentials.
|
179 |
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '') |
180 |
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '') |
181 |
|
182 |
# URL to redirect the user after successful login when no next parameter is set
|
183 |
default_success_url = join_urls('/', BASE_PATH, VIEWS_PREFIX, "landing") |
184 |
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL', |
185 |
default_success_url) |
186 |
|
187 |
# Whether or not to display projects in astakos menu
|
188 |
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False) |
189 |
|
190 |
# A way to extend the components presentation metadata
|
191 |
COMPONENTS_META = getattr(settings, 'ASTAKOS_COMPONENTS_META', {}) |
192 |
|
193 |
# A way to extend the resources presentation metadata
|
194 |
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {}) |
195 |
|
196 |
# Do not require email verification for new users
|
197 |
SKIP_EMAIL_VERIFICATION = getattr(settings,
|
198 |
'ASTAKOS_SKIP_EMAIL_VERIFICATION', False) |
199 |
|
200 |
# Kamaki download url. Displayed in api access view
|
201 |
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL', |
202 |
'https://pypi.python.org/pypi/kamaki')
|
203 |
|
204 |
KAMAKI_CONFIG_CLOUD_NAME = getattr(settings,
|
205 |
'ASTAKOS_KAMAKI_CONFIG_CLOUD_NAME',
|
206 |
None)
|
207 |
|
208 |
REDIRECT_ALLOWED_SCHEMES = getattr(settings,
|
209 |
'ASTAKOS_REDIRECT_ALLOWED_SCHEMES',
|
210 |
('pithos', 'pithosdev')) |
211 |
|
212 |
ADMIN_STATS_PERMITTED_GROUPS = getattr(settings,
|
213 |
'ASTAKOS_ADMIN_STATS_PERMITTED_GROUPS',
|
214 |
['admin-stats'])
|
215 |
|
216 |
ENDPOINT_CACHE_TIMEOUT = getattr(settings,
|
217 |
'ASTAKOS_ENDPOINT_CACHE_TIMEOUT',
|
218 |
60)
|