settings.py 10.5 KB
Newer Older
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
1
2
3
4
5
6
7
8
9
from django.conf import settings

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

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

INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
10
11
12
13
14
    0: 100,
    1: 2,
    2: 0,
    3: 0,
    4: 0
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
15
16
})

17
18
19
ADMINS = getattr(settings, 'ADMINS', ())
MANAGERS = getattr(settings, 'MANAGERS', ADMINS)
HELPDESK = getattr(settings, 'HELPDESK', ADMINS)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
20

21
22
CONTACT_EMAIL = settings.CONTACT_EMAIL
SERVER_EMAIL = settings.SERVER_EMAIL
Giorgos Korfiatis's avatar
Giorgos Korfiatis committed
23

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
24
# Identity Management enabled modules
25
26
# Supported modules are: 'local', 'twitter' and 'shibboleth'
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
27
28

# Force user profile verification
29
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
30
31

#Enable invitations
32
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
33
34
35

COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
36
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
37

38
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
39

40
41
# If set to False and invitations not enabled newly created user
# will be automatically accepted
42
43
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True)

44
# Set baseurl
45
BASEURL = getattr(settings, 'ASTAKOS_BASEURL', 'https://accounts.example.synnefo.org')
46
47

# Set service name
48
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', 'Synnefo Cloud')
49

50
51
52
# Set recaptcha keys
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '')
53
54
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
                            {'theme': 'custom', 'custom_theme_widget': 'okeanos_recaptcha'})
55
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True)
56
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False)
57

58
# set AstakosUser fields to propagate in the billing system
59
BILLING_FIELDS = getattr(settings, 'ASTAKOS_BILLING_FIELDS', ['is_active'])
60
61

# Queue for billing.
62
QUEUE_CONNECTION = getattr(settings, 'ASTAKOS_QUEUE_CONNECTION', None)  # Example: 'rabbitmq://guest:guest@localhost:5672/astakos'
63
64

# Set where the user should be redirected after logout
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
65
66
67
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')

# Set user email patterns that are automatically activated
68
69
RE_USER_EMAIL_PATTERNS = getattr(
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
70

71
72
# Messages to display on login page header
# e.g. {'warning': 'This warning message will be displayed on the top of login page'}
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
73
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', [])
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
74

75
76
# Messages to display on login page header
# e.g. {'warning': 'This warning message will be displayed on the top of signup page'}
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
77
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', [])
78
79
80

# Messages to display on login page header
# e.g. {'warning': 'This warning message will be displayed on the top of profile page'}
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
81
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', [])
82
83
84

# Messages to display on all pages
# e.g. {'warning': 'This warning message will be displayed on the top of every page'}
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
85
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', [])
86

87
88
89
90
# messages to display as extra actions in account forms
# e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'}
PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {})

91
# The number of unsuccessful login requests per minute allowed for a specific user
92
93
RATELIMIT_RETRIES_ALLOWED = getattr(
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
94

95
96
97
98
# If False the email change mechanism is disabled
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)

# Set the expiration time (in days) of email change requests
99
100
EMAILCHANGE_ACTIVATION_DAYS = getattr(
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
101

102
# Set the astakos main functions logging severity (None to disable)
103
from logging import INFO
104
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
105

106
# Configurable email subjects
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
107
108
109
INVITATION_EMAIL_SUBJECT = getattr(
    settings, 'ASTAKOS_INVITATION_EMAIL_SUBJECT',
    'Invitation to %s alpha2 testing' % SITENAME)
110
GREETING_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_GREETING_EMAIL_SUBJECT',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
111
                                 'Welcome to %s alpha2 testing' % SITENAME)
112
FEEDBACK_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_FEEDBACK_EMAIL_SUBJECT',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
113
114
115
116
117
118
119
                                 'Feedback from %s alpha2 testing' % SITENAME)
VERIFICATION_EMAIL_SUBJECT = getattr(
    settings, 'ASTAKOS_VERIFICATION_EMAIL_SUBJECT',
    '%s alpha2 testing account activation is needed' % SITENAME)
ACCOUNT_CREATION_SUBJECT = getattr(
    settings, 'ASTAKOS_ACCOUNT_CREATION_SUBJECT',
    '%s alpha2 testing account created (%%(user)s)' % SITENAME)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
120
121
122
GROUP_CREATION_SUBJECT = getattr(
    settings, 'ASTAKOS_GROUP_CREATION_SUBJECT',
    '%s alpha2 testing group created (%%(group)s)' % SITENAME)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
123
124
125
126
127
128
129
130
131
HELPDESK_NOTIFICATION_EMAIL_SUBJECT = getattr(
    settings, 'ASTAKOS_HELPDESK_NOTIFICATION_EMAIL_SUBJECT',
    '%s alpha2 testing account activated (%%(user)s)' % SITENAME)
EMAIL_CHANGE_EMAIL_SUBJECT = getattr(
    settings, 'ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT',
    'Email change on %s alpha2 testing' % SITENAME)
PASSWORD_RESET_EMAIL_SUBJECT = getattr(
    settings, 'ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT',
    'Password reset on %s alpha2 testing' % SITENAME)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
132
133
134
135
136
137
PROJECT_CREATION_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_CREATION_SUBJECT',
    '%s alpha2 testing project application created (%%(name)s)' % SITENAME)
PROJECT_APPROVED_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_APPROVED_SUBJECT',
    '%s alpha2 testing project application approved (%%(name)s)' % SITENAME)
138
139
140
PROJECT_DENIED_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_DENIED_SUBJECT',
    '%s alpha2 testing project application denied (%%(name)s)' % SITENAME)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
141
142
143
144
145
146
147
148
149
PROJECT_TERMINATION_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_TERMINATION_SUBJECT',
    '%s alpha2 testing project terminated (%%(name)s)' % SITENAME)
PROJECT_SUSPENSION_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_SUSPENSION_SUBJECT',
    '%s alpha2 testing project suspended (%%(name)s)' % SITENAME)
PROJECT_MEMBERSHIP_CHANGE_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_CHANGE_SUBJECT',
    '%s alpha2 testing project membership changed (%%(name)s)' % SITENAME)
150
151
152
PROJECT_MEMBERSHIP_ENROLL_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_ENROLL_SUBJECT',
    '%s alpha2 testing project enrollment (%%(name)s)' % SITENAME)
153
154
155
156
157
158
PROJECT_MEMBERSHIP_REQUEST_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_REQUEST_SUBJECT',
    '%s alpha2 testing project membership request (%%(name)s)' % SITENAME)
PROJECT_MEMBERSHIP_LEAVE_REQUEST_SUBJECT = getattr(
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_LEAVE_REQUEST_SUBJECT',
    '%s alpha2 testing project membership leave request (%%(name)s)' % SITENAME)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
159

160
# Set the quota holder component URI
161
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
Kostas Papadimitriou's avatar
Kostas Papadimitriou committed
162
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_TOKEN', '')
163
QUOTAHOLDER_POOLSIZE = getattr(settings, 'ASTAKOS_QUOTAHOLDER_POOLSIZE', 50)
164
165
166
167

# Set the billing URI
AQUARIUM_URL = getattr(settings, 'ASTAKOS_AQUARIUM_URL', '')

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
168
# Set how many objects should be displayed per page
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
169
170
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)

171
# Set how many objects should be displayed per page in show all projects page
Olga Brani's avatar
Fixes    
Olga Brani committed
172
173
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 15)

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
174
175
# Enforce token renewal on password change/reset
NEWPASSWD_INVALIDATE_TOKEN = getattr(
root's avatar
root committed
176
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
Olga Brani's avatar
Olga Brani committed
177

178
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
Olga Brani's avatar
Olga Brani committed
179

180
# Permit local account migration
181
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
182
183
184
185
186

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

PROJECT_MEMBER_JOIN_POLICIES = getattr(settings,
                                'ASTAKOS_PROJECT_MEMBER_JOIN_POLICIES',
190
191
192
                                {'1':'automatically accepted',
                                 '2':'owner accepts',
                                 '3':'closed'})
193
194
195

PROJECT_MEMBER_LEAVE_POLICIES = getattr(settings,
                                'ASTAKOS_PROJECT_MEMBER_LEAVE_POLICIES',
196
197
198
                                {'1':'automatically accepted',
                                 '2':'owner accepts',
                                 '3':'closed'})
199
200
201

ACTIVATION_REDIRECT_URL = getattr(settings,
                                  'ASTAKOS_ACTIVATION_REDIRECT_URL',
202
                                  "/im/landing")
203

204

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

209
210
# Users that can approve or deny project applications from the web.
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
211

212
213
214
215
# Maximum pending project applications per applicant.
# This is to reduce the volume of applications
# in case users abuse the mechanism.
PENDING_APPLICATION_LIMIT = getattr(settings,
216
                                    'ASTAKOS_PENDING_APPLICATION_LIMIT', 0)
217

218
219
220
221
222
223
224
225
226
227
228
229
230
# OAuth2 Twitter credentials.
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
                                  False)

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

# OAuth2 LinkedIn credentials.
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
231

232
# URL to redirect the user after successful login when no next parameter is set
233
234
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
                            '/im/landing')
235
236
237

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

# A way to extend the settings presentation metadata
240
SERVICES_META = getattr(settings, 'ASTAKOS_SERVICES_META', {})