Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 2a0dfa0a

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

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

    
31
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
32

    
33
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
34
    0: 100,
35
    1: 2,
36
    2: 0,
37
    3: 0,
38
    4: 0
39
})
40

    
41
ADMINS = tuple(getattr(settings, 'ADMINS', ()))
42
MANAGERS = tuple(getattr(settings, 'MANAGERS', ()))
43
HELPDESK = tuple(getattr(settings, 'HELPDESK', ()))
44

    
45
CONTACT_EMAIL = settings.CONTACT_EMAIL
46
SERVER_EMAIL = settings.SERVER_EMAIL
47
SECRET_KEY = settings.SECRET_KEY
48
SESSION_ENGINE = settings.SESSION_ENGINE
49

    
50
# Identity Management enabled modules
51
# Supported modules are: 'local', 'twitter' and 'shibboleth'
52
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
53

    
54
# Force user profile verification
55
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False)
56

    
57
#Enable invitations
58
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
59

    
60
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
61
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
62
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
63

    
64
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
65

    
66
# If set to False and invitations not enabled newly created user
67
# will be automatically accepted
68
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True)
69

    
70
# Set service name
71
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME)
72

    
73
# Set recaptcha keys
74
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
75
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '')
76
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
77
                            {'theme': 'custom',
78
                             'custom_theme_widget': 'okeanos_recaptcha'})
79
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True)
80
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False)
81

    
82
# Set where the user should be redirected after logout
83
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
84

    
85
# Set user email patterns that are automatically activated
86
RE_USER_EMAIL_PATTERNS = getattr(
87
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
88

    
89
# Messages to display on login page header
90
# e.g. {'warning':
91
#       'This warning message will be displayed on the top of login page'}
92
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', [])
93

    
94
# Messages to display on login page header
95
# e.g. {'warning':
96
#       'This warning message will be displayed on the top of signup page'}
97
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', [])
98

    
99
# Messages to display on login page header
100
# e.g. {'warning':
101
#       'This warning message will be displayed on the top of profile page'}
102
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', [])
103

    
104
# Messages to display on all pages
105
# e.g. {'warning':
106
#       'This warning message will be displayed on the top of every page'}
107
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', [])
108

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

    
113
# The number of unsuccessful login requests per minute allowed
114
# for a specific user
115
RATELIMIT_RETRIES_ALLOWED = getattr(
116
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
117

    
118
# If False the email change mechanism is disabled
119
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
120

    
121
# Set the expiration time (in days) of email change requests
122
EMAILCHANGE_ACTIVATION_DAYS = getattr(
123
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
124

    
125
# Set the astakos main functions logging severity (None to disable)
126
from logging import INFO
127
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
128

    
129
# Set how many objects should be displayed per page
130
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50)
131

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

    
135
# Enforce token renewal on password change/reset
136
NEWPASSWD_INVALIDATE_TOKEN = getattr(
137
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
138

    
139
# Interval at which to update the user's available quota in astakos usage
140
# profile view
141
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL',
142
                                5000)
143

    
144
# Permit local account migration
145
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(
146
    settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
147

    
148
# Migrate eppn identifiers to remote id
149
SHIBBOLETH_MIGRATE_EPPN = getattr(settings, 'ASTAKOS_SHIBBOLETH_MIGRATE_EPPN',
150
                                  False)
151

    
152
# Strict shibboleth usage
153
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
154
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
155
                                       False)
156

    
157
default_activation_redirect_url = join_urls('/', BASE_PATH, VIEWS_PREFIX,
158
                                            "landing")
159
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
160
                                  default_activation_redirect_url)
161

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

    
166
# Users that can approve or deny project applications from the web.
167
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
168

    
169
# OAuth2 Twitter credentials.
170
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
171
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
172
TWITTER_AUTH_FORCE_LOGIN = getattr(
173
    settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN', False)
174

    
175
# OAuth2 Google credentials.
176
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '')
177
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
178

    
179
# OAuth2 LinkedIn credentials.
180
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
181
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
182

    
183
# URL to redirect the user after successful login when no next parameter is set
184
default_success_url = join_urls('/', BASE_PATH, VIEWS_PREFIX, "landing")
185
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
186
                            default_success_url)
187

    
188
# Whether or not to display projects in astakos menu
189
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False)
190

    
191
# A way to extend the components presentation metadata
192
COMPONENTS_META = getattr(settings, 'ASTAKOS_COMPONENTS_META', {})
193

    
194
# A way to extend the resources presentation metadata
195
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
196

    
197
# Do not require email verification for new users
198
SKIP_EMAIL_VERIFICATION = getattr(settings,
199
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)
200

    
201
# Kamaki download url. Displayed in api access view
202
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL',
203
                         'https://pypi.python.org/pypi/kamaki')
204

    
205
KAMAKI_CONFIG_CLOUD_NAME = getattr(settings,
206
                                   'ASTAKOS_KAMAKI_CONFIG_CLOUD_NAME',
207
                                   None)
208

    
209
REDIRECT_ALLOWED_SCHEMES = getattr(settings,
210
                                   'ASTAKOS_REDIRECT_ALLOWED_SCHEMES',
211
                                   ('pithos', 'pithosdev'))
212

    
213
ADMIN_STATS_PERMITTED_GROUPS = getattr(settings,
214
                                       'ASTAKOS_ADMIN_STATS_PERMITTED_GROUPS',
215
                                       ['admin-stats'])