Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (10.4 kB)

1
# Copyright 2012-2014 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.lib import join_urls
39
from synnefo.lib.services import fill_endpoints
40

    
41
from copy import deepcopy
42

    
43

    
44
BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
45
                   'https://accounts.example.synnefo.org')
46

    
47

    
48
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
49

    
50
astakos_services = deepcopy(vanilla_astakos_services)
51
fill_endpoints(astakos_services, BASE_URL)
52
ACCOUNTS_PREFIX = astakos_services['astakos_account']['prefix']
53
VIEWS_PREFIX = astakos_services['astakos_ui']['prefix']
54
KEYSTONE_PREFIX = astakos_services['astakos_identity']['prefix']
55
WEBLOGIN_PREFIX = astakos_services['astakos_weblogin']['prefix']
56
ADMIN_PREFIX = astakos_services['astakos_admin']['prefix']
57

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

    
62
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
63

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

    
72
ADMINS = tuple(getattr(settings, 'ADMINS', ()))
73
MANAGERS = tuple(getattr(settings, 'MANAGERS', ()))
74
HELPDESK = tuple(getattr(settings, 'HELPDESK', ()))
75

    
76
CONTACT_EMAIL = settings.CONTACT_EMAIL
77
SERVER_EMAIL = settings.SERVER_EMAIL
78
SECRET_KEY = settings.SECRET_KEY
79
SESSION_ENGINE = settings.SESSION_ENGINE
80

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

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

    
88
#Enable invitations
89
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
90

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

    
95
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
96

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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