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