Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ e28a4841

History | View | Annotate | Download (10.5 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
OA2_PREFIX = get_path(astakos_services, 'astakos_oa2.prefix')
59

    
60
# Set the expiration time of newly created auth tokens
61
# to be this many hours after their creation time.
62
AUTH_TOKEN_DURATION = getattr(settings, 'ASTAKOS_AUTH_TOKEN_DURATION', 30 * 24)
63

    
64
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
65

    
66
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
67
    0: 100,
68
    1: 2,
69
    2: 0,
70
    3: 0,
71
    4: 0
72
})
73

    
74
ADMINS = tuple(getattr(settings, 'ADMINS', ()))
75
MANAGERS = tuple(getattr(settings, 'MANAGERS', ()))
76
HELPDESK = tuple(getattr(settings, 'HELPDESK', ()))
77

    
78
CONTACT_EMAIL = settings.CONTACT_EMAIL
79
SERVER_EMAIL = settings.SERVER_EMAIL
80
SECRET_KEY = settings.SECRET_KEY
81
SESSION_ENGINE = settings.SESSION_ENGINE
82

    
83
# Identity Management enabled modules
84
# Supported modules are: 'local', 'twitter' and 'shibboleth'
85
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
86

    
87
# Force user profile verification
88
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False)
89

    
90
#Enable invitations
91
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
92

    
93
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
94
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
95
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
96

    
97
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
98

    
99
# If set to False and invitations not enabled newly created user
100
# will be automatically accepted
101
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True)
102

    
103
# Set service name
104
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME)
105

    
106
# Set recaptcha keys
107
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
108
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '')
109
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
110
                            {'theme': 'custom',
111
                             'custom_theme_widget': 'okeanos_recaptcha'})
112
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True)
113
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False)
114

    
115
# Set where the user should be redirected after logout
116
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
117

    
118
# Set user email patterns that are automatically activated
119
RE_USER_EMAIL_PATTERNS = getattr(
120
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
121

    
122
# Messages to display on login page header
123
# e.g. {'warning':
124
#       'This warning message will be displayed on the top of login page'}
125
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', [])
126

    
127
# Messages to display on login page header
128
# e.g. {'warning':
129
#       'This warning message will be displayed on the top of signup page'}
130
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', [])
131

    
132
# Messages to display on login page header
133
# e.g. {'warning':
134
#       'This warning message will be displayed on the top of profile page'}
135
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', [])
136

    
137
# Messages to display on all pages
138
# e.g. {'warning':
139
#       'This warning message will be displayed on the top of every page'}
140
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', [])
141

    
142
# messages to display as extra actions in account forms
143
# e.g. {'https://www.myhomepage.com': 'Back to <service_name>'}
144
PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {})
145

    
146
# The number of unsuccessful login requests per minute allowed
147
# for a specific user
148
RATELIMIT_RETRIES_ALLOWED = getattr(
149
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
150

    
151
# If False the email change mechanism is disabled
152
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
153

    
154
# Set the expiration time (in days) of email change requests
155
EMAILCHANGE_ACTIVATION_DAYS = getattr(
156
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
157

    
158
# Set the astakos main functions logging severity (None to disable)
159
from logging import INFO
160
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
161

    
162
# Set how many objects should be displayed per page
163
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50)
164

    
165
# Set how many objects should be displayed per page in show all projects page
166
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 50)
167

    
168
# Enforce token renewal on password change/reset
169
NEWPASSWD_INVALIDATE_TOKEN = getattr(
170
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
171

    
172
# Interval at which to update the user's available quota in astakos usage
173
# profile view
174
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL',
175
                                5000)
176

    
177
# Permit local account migration
178
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(
179
    settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
180

    
181
# Migrate eppn identifiers to remote id
182
SHIBBOLETH_MIGRATE_EPPN = getattr(settings, 'ASTAKOS_SHIBBOLETH_MIGRATE_EPPN',
183
                                  False)
184

    
185
# Strict shibboleth usage
186
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
187
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
188
                                       False)
189

    
190
default_activation_redirect_url = join_urls('/', BASE_PATH, VIEWS_PREFIX,
191
                                            "landing")
192
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
193
                                  default_activation_redirect_url)
194

    
195
# If true, this enables a ui compatibility layer for the introduction of UUIDs
196
# in identity management. WARNING: Setting to True will break your installation
197
TRANSLATE_UUIDS = getattr(settings, 'ASTAKOS_TRANSLATE_UUIDS', False)
198

    
199
# Users that can approve or deny project applications from the web.
200
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
201

    
202
# OAuth2 Twitter credentials.
203
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
204
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
205
TWITTER_AUTH_FORCE_LOGIN = getattr(
206
    settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN', False)
207

    
208
# OAuth2 Google credentials.
209
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '')
210
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
211

    
212
# OAuth2 LinkedIn credentials.
213
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
214
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
215

    
216
# URL to redirect the user after successful login when no next parameter is set
217
default_success_url = join_urls('/', BASE_PATH, VIEWS_PREFIX, "landing")
218
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
219
                            default_success_url)
220

    
221
# Whether or not to display projects in astakos menu
222
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False)
223

    
224
# A way to extend the components presentation metadata
225
COMPONENTS_META = getattr(settings, 'ASTAKOS_COMPONENTS_META', {})
226

    
227
# A way to extend the resources presentation metadata
228
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
229

    
230
# Do not require email verification for new users
231
SKIP_EMAIL_VERIFICATION = getattr(settings,
232
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)
233

    
234
# Kamaki download url. Displayed in api access view
235
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL',
236
                         'https://pypi.python.org/pypi/kamaki')
237

    
238
KAMAKI_CONFIG_CLOUD_NAME = getattr(settings,
239
                                   'ASTAKOS_KAMAKI_CONFIG_CLOUD_NAME',
240
                                   None)
241

    
242
REDIRECT_ALLOWED_SCHEMES = getattr(settings,
243
                                   'ASTAKOS_REDIRECT_ALLOWED_SCHEMES',
244
                                   ('pithos', 'pithosdev'))
245

    
246
ADMIN_STATS_PERMITTED_GROUPS = getattr(settings,
247
                                       'ASTAKOS_ADMIN_STATS_PERMITTED_GROUPS',
248
                                       ['admin-stats'])
249

    
250
ENDPOINT_CACHE_TIMEOUT = getattr(settings,
251
                                 'ASTAKOS_ENDPOINT_CACHE_TIMEOUT',
252
                                 60)
253

    
254
RESOURCE_CACHE_TIMEOUT = getattr(settings,
255
                                 'ASTAKOS_RESOURCE_CACHE_TIMEOUT',
256
                                 60)