root / snf-astakos-app / astakos / im / settings.py @ d2cfb7a1
History | View | Annotate | Download (10.6 kB)
1 |
# Copyright 2012, 2013 GRNET S.A. All rights reserved.
|
---|---|
2 |
#
|
3 |
# Redistribution and use in source and binary forms, with or
|
4 |
# without modification, are permitted provided that the following
|
5 |
# conditions are met:
|
6 |
#
|
7 |
# 1. Redistributions of source code must retain the above
|
8 |
# copyright notice, this list of conditions and the following
|
9 |
# disclaimer.
|
10 |
#
|
11 |
# 2. Redistributions in binary form must reproduce the above
|
12 |
# copyright notice, this list of conditions and the following
|
13 |
# disclaimer in the documentation and/or other materials
|
14 |
# provided with the distribution.
|
15 |
#
|
16 |
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
17 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
20 |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
23 |
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
24 |
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
25 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
26 |
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
# POSSIBILITY OF SUCH DAMAGE.
|
28 |
#
|
29 |
# The views and conclusions contained in the software and
|
30 |
# documentation are those of the authors and should not be
|
31 |
# interpreted as representing official policies, either expressed
|
32 |
# or implied, of GRNET S.A.
|
33 |
|
34 |
from django.conf import settings |
35 |
from synnefo_branding import settings as synnefo_settings |
36 |
from synnefo.lib import parse_base_url |
37 |
from astakos.api.services import astakos_services as vanilla_astakos_services |
38 |
from synnefo.util.keypath import get_path |
39 |
from synnefo.lib import join_urls |
40 |
from synnefo.lib.services import fill_endpoints |
41 |
|
42 |
from copy import deepcopy |
43 |
|
44 |
|
45 |
BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL', |
46 |
'https://accounts.example.synnefo.org')
|
47 |
|
48 |
|
49 |
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL) |
50 |
|
51 |
astakos_services = deepcopy(vanilla_astakos_services) |
52 |
fill_endpoints(astakos_services, BASE_URL) |
53 |
ACCOUNTS_PREFIX = get_path(astakos_services, ['astakos_account', 'prefix']) |
54 |
VIEWS_PREFIX = get_path(astakos_services, ['astakos_ui', 'prefix']) |
55 |
KEYSTONE_PREFIX = get_path(astakos_services, ['astakos_identity', 'prefix']) |
56 |
WEBLOGIN_PREFIX = get_path(astakos_services, ['astakos_weblogin', 'prefix']) |
57 |
ADMIN_PREFIX = get_path(astakos_services, ['astakos_admin', 'prefix']) |
58 |
|
59 |
# Set the expiration time of newly created auth tokens
|
60 |
# to be this many hours after their creation time.
|
61 |
AUTH_TOKEN_DURATION = getattr(settings, 'ASTAKOS_AUTH_TOKEN_DURATION', 30 * 24) |
62 |
|
63 |
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4) |
64 |
|
65 |
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', { |
66 |
0: 100, |
67 |
1: 2, |
68 |
2: 0, |
69 |
3: 0, |
70 |
4: 0 |
71 |
}) |
72 |
|
73 |
ADMINS = tuple(getattr(settings, 'ADMINS', ())) |
74 |
MANAGERS = tuple(getattr(settings, 'MANAGERS', ())) |
75 |
HELPDESK = tuple(getattr(settings, 'HELPDESK', ())) |
76 |
|
77 |
CONTACT_EMAIL = settings.CONTACT_EMAIL |
78 |
SERVER_EMAIL = settings.SERVER_EMAIL |
79 |
SECRET_KEY = settings.SECRET_KEY |
80 |
SESSION_ENGINE = settings.SESSION_ENGINE |
81 |
|
82 |
# Identity Management enabled modules
|
83 |
# Supported modules are: 'local', 'twitter' and 'shibboleth'
|
84 |
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local']) |
85 |
|
86 |
# Force user profile verification
|
87 |
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False) |
88 |
|
89 |
#Enable invitations
|
90 |
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False) |
91 |
|
92 |
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a') |
93 |
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None) |
94 |
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True) |
95 |
|
96 |
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/') |
97 |
|
98 |
# If set to False and invitations not enabled newly created user
|
99 |
# will be automatically accepted
|
100 |
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True) |
101 |
|
102 |
# Set service name
|
103 |
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME) |
104 |
|
105 |
# Set recaptcha keys
|
106 |
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '') |
107 |
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '') |
108 |
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS', |
109 |
{'theme': 'custom', |
110 |
'custom_theme_widget': 'okeanos_recaptcha'}) |
111 |
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True) |
112 |
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False) |
113 |
|
114 |
# Set where the user should be redirected after logout
|
115 |
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '') |
116 |
|
117 |
# Set user email patterns that are automatically activated
|
118 |
RE_USER_EMAIL_PATTERNS = getattr(
|
119 |
settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
|
120 |
|
121 |
# Messages to display on login page header
|
122 |
# e.g. {'warning':
|
123 |
# 'This warning message will be displayed on the top of login page'}
|
124 |
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', []) |
125 |
|
126 |
# Messages to display on login page header
|
127 |
# e.g. {'warning':
|
128 |
# 'This warning message will be displayed on the top of signup page'}
|
129 |
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', []) |
130 |
|
131 |
# Messages to display on login page header
|
132 |
# e.g. {'warning':
|
133 |
# 'This warning message will be displayed on the top of profile page'}
|
134 |
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', []) |
135 |
|
136 |
# Messages to display on all pages
|
137 |
# e.g. {'warning':
|
138 |
# 'This warning message will be displayed on the top of every page'}
|
139 |
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', []) |
140 |
|
141 |
# messages to display as extra actions in account forms
|
142 |
# e.g. {'https://www.myhomepage.com': 'Back to <service_name>'}
|
143 |
PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {}) |
144 |
|
145 |
# The number of unsuccessful login requests per minute allowed
|
146 |
# for a specific user
|
147 |
RATELIMIT_RETRIES_ALLOWED = getattr(
|
148 |
settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3) |
149 |
|
150 |
# If False the email change mechanism is disabled
|
151 |
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False) |
152 |
|
153 |
# Set the expiration time (in days) of email change requests
|
154 |
EMAILCHANGE_ACTIVATION_DAYS = getattr(
|
155 |
settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10) |
156 |
|
157 |
# Set the astakos main functions logging severity (None to disable)
|
158 |
from logging import INFO |
159 |
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO) |
160 |
|
161 |
# Set how many objects should be displayed per page
|
162 |
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50) |
163 |
|
164 |
# Set how many objects should be displayed per page in show all projects page
|
165 |
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 50) |
166 |
|
167 |
# Enforce token renewal on password change/reset
|
168 |
NEWPASSWD_INVALIDATE_TOKEN = getattr(
|
169 |
settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True) |
170 |
|
171 |
# Interval at which to update the user's available quota in astakos usage
|
172 |
# profile view
|
173 |
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', |
174 |
5000)
|
175 |
|
176 |
# Permit local account migration
|
177 |
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(
|
178 |
settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True) |
179 |
|
180 |
# Migrate eppn identifiers to remote id
|
181 |
SHIBBOLETH_MIGRATE_EPPN = getattr(settings, 'ASTAKOS_SHIBBOLETH_MIGRATE_EPPN', |
182 |
False)
|
183 |
|
184 |
# Migrate eppn identifiers to remote id
|
185 |
SHIBBOLETH_MIGRATE_EPPN = getattr(settings, 'ASTAKOS_SHIBBOLETH_MIGRATE_EPPN', |
186 |
False)
|
187 |
|
188 |
# Strict shibboleth usage
|
189 |
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
|
190 |
'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
|
191 |
False)
|
192 |
|
193 |
default_activation_redirect_url = join_urls('/', BASE_PATH, VIEWS_PREFIX,
|
194 |
"landing")
|
195 |
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL', |
196 |
default_activation_redirect_url) |
197 |
|
198 |
# If true, this enables a ui compatibility layer for the introduction of UUIDs
|
199 |
# in identity management. WARNING: Setting to True will break your installation
|
200 |
TRANSLATE_UUIDS = getattr(settings, 'ASTAKOS_TRANSLATE_UUIDS', False) |
201 |
|
202 |
# Users that can approve or deny project applications from the web.
|
203 |
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set()) |
204 |
|
205 |
# OAuth2 Twitter credentials.
|
206 |
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '') |
207 |
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '') |
208 |
TWITTER_AUTH_FORCE_LOGIN = getattr(
|
209 |
settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN', False) |
210 |
|
211 |
# OAuth2 Google credentials.
|
212 |
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '') |
213 |
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '') |
214 |
|
215 |
# OAuth2 LinkedIn credentials.
|
216 |
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '') |
217 |
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '') |
218 |
|
219 |
# URL to redirect the user after successful login when no next parameter is set
|
220 |
default_success_url = join_urls('/', BASE_PATH, VIEWS_PREFIX, "landing") |
221 |
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL', |
222 |
default_success_url) |
223 |
|
224 |
# Whether or not to display projects in astakos menu
|
225 |
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False) |
226 |
|
227 |
# A way to extend the components presentation metadata
|
228 |
COMPONENTS_META = getattr(settings, 'ASTAKOS_COMPONENTS_META', {}) |
229 |
|
230 |
# A way to extend the resources presentation metadata
|
231 |
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {}) |
232 |
|
233 |
# Do not require email verification for new users
|
234 |
SKIP_EMAIL_VERIFICATION = getattr(settings,
|
235 |
'ASTAKOS_SKIP_EMAIL_VERIFICATION', False) |
236 |
|
237 |
# Kamaki download url. Displayed in api access view
|
238 |
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL', |
239 |
'https://pypi.python.org/pypi/kamaki')
|
240 |
|
241 |
KAMAKI_CONFIG_CLOUD_NAME = getattr(settings,
|
242 |
'ASTAKOS_KAMAKI_CONFIG_CLOUD_NAME',
|
243 |
None)
|
244 |
|
245 |
REDIRECT_ALLOWED_SCHEMES = getattr(settings,
|
246 |
'ASTAKOS_REDIRECT_ALLOWED_SCHEMES',
|
247 |
('pithos', 'pithosdev')) |
248 |
|
249 |
ADMIN_STATS_PERMITTED_GROUPS = getattr(settings,
|
250 |
'ASTAKOS_ADMIN_STATS_PERMITTED_GROUPS',
|
251 |
['admin-stats'])
|
252 |
|
253 |
ENDPOINT_CACHE_TIMEOUT = getattr(settings,
|
254 |
'ASTAKOS_ENDPOINT_CACHE_TIMEOUT',
|
255 |
60)
|
256 |
|
257 |
RESOURCE_CACHE_TIMEOUT = getattr(settings,
|
258 |
'ASTAKOS_RESOURCE_CACHE_TIMEOUT',
|
259 |
60)
|