Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (15.4 kB)

1
from django.conf import settings
2
from synnefo_branding import settings as synnefo_settings
3

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

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

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

    
18
# Address to use for outgoing emails
19
DEFAULT_CONTACT_EMAIL = getattr(
20
    settings, 'ASTAKOS_DEFAULT_CONTACT_EMAIL', 'support@example.synnefo.org')
21

    
22
SERVER_EMAIL = getattr(settings, 'SERVER_EMAIL', None)
23
ADMINS = getattr(settings, 'ADMINS', None)
24

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

    
29
# Force user profile verification
30
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', True)
31

    
32
#Enable invitations
33
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
34

    
35
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
36
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
37
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
38

    
39
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
40

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

    
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_settings.SERVICE_NAME)
49

    
50
# Set recaptcha keys
51
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
52
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '')
53
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
54
                            {'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
# Example: 'rabbitmq://guest:guest@localhost:5672/astakos'
63
QUEUE_CONNECTION = getattr(settings, 'ASTAKOS_QUEUE_CONNECTION', None)  
64
# Set where the user should be redirected after logout
65
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
66

    
67
# Set user email patterns that are automatically activated
68
RE_USER_EMAIL_PATTERNS = getattr(
69
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
70

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

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

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

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

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

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

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

    
98
# Set the expiration time (in days) of email change requests
99
EMAILCHANGE_ACTIVATION_DAYS = getattr(
100
    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)
105

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

    
160
# Set the quota holder component URI
161
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
162
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_TOKEN', '')
163

    
164
# Set the cloud service properties
165
SERVICES = getattr(settings, 'ASTAKOS_SERVICES', {
166
    'cyclades': {
167
#        # Specifying the key 'url' will overwrite it.
168
#        # Use this to (re)set service URL.
169
#        'url': 'https://cyclades.example.synnefo.org/ui/',
170
#        # order services in listings, cloudbar, etc.
171
#        'order' : 1
172
        'resources': [{
173
            'name': 'disk',
174
            'group': 'compute',
175
            'uplimit': 30*1024*1024*1024,
176
            'unit': 'bytes',
177
            'desc': 'Virtual machine disk size'
178
            }, {
179
            'name': 'cpu',
180
            'group': 'compute',
181
            'uplimit': 6,
182
            'desc': 'Number of virtual machine processors'
183
            }, {
184
            'name': 'ram',
185
            'group': 'compute',
186
            'uplimit': 6*1024*1024*1024,
187
            'unit': 'bytes',
188
            'desc': 'Virtual machines'
189
            }, {
190
            'name': 'vm',
191
            'group': 'compute',
192
            'uplimit': 2,
193
            'desc': 'Number of virtual machines'
194
            }, {
195
            'name': 'network.private',
196
            'group': 'network',
197
            'uplimit': 1,
198
            'desc': 'Private networks'
199
            }
200
        ]
201
    },
202
    'pithos+': {
203
#        # Use this to (re)set service URL.
204
#        'url': 'https://pithos.example.synnefo.org/ui/',
205
#        # order services in listings, cloudbar, etc.
206
#        'order' : 2
207
        'resources':[{
208
            'name': 'diskspace',
209
            'group': 'storage',
210
            'uplimit': 5*1024*1024*1024,
211
            'unit': 'bytes',
212
            'desc': 'Pithos account diskspace'
213
            }]
214
    }
215
})
216

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

    
220
# Set how many objects should be displayed per page
221
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)
222

    
223
# Set how many objects should be displayed per page in show all projects page
224
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 15)
225

    
226
# Enforce token renewal on password change/reset
227
NEWPASSWD_INVALIDATE_TOKEN = getattr(
228
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
229

    
230
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
231

    
232
RESOURCES_PRESENTATION_DATA = getattr(
233
    settings, 'ASTAKOS_RESOURCES_PRESENTATION_DATA', {
234
        'groups': {
235
             'compute': {
236
                'help_text':'Compute resources (amount of VMs, CPUs, RAM, System disk) ',
237
                'is_abbreviation':False,
238
                'report_desc':'',
239
                 'verbose_name':'compute',
240
            },
241
            'storage': {
242
                'help_text':'Storage resources (amount of space to store files on Pithos) ',
243
                'is_abbreviation':False,
244
                'report_desc':'',
245
                 'verbose_name':'storage',
246
            },
247
            'network': {
248
                'help_text':' Network resources (number of Private Networks)  ',
249
                'is_abbreviation':False,
250
                'report_desc':'',
251
                'verbose_name':'network',
252
            },
253
        },
254
        'resources': {
255
            'pithos+.diskspace': {
256
                'help_text':'This is the space on Pithos for storing files and VM Images. ',
257
                'help_text_input_each':'This is the total amount of space on Pithos that will be granted to each user of this Project ',
258
                'is_abbreviation':False,
259
                'report_desc':'Storage Space',
260
                'placeholder':'eg. 10GB',
261
                'verbose_name':'Storage Space',
262
            },
263
            'cyclades.disk': {
264
                'help_text':'This is the System Disk that the VMs have that run the OS ',
265
                'help_text_input_each':"This is the total amount of System Disk that will be granted to each user of this Project (this refers to the total System Disk of all VMs, not each VM's System Disk)  ",
266
                'is_abbreviation':False,
267
                'report_desc':'System Disk',
268
                'placeholder':'eg. 5GB, 2GB etc',
269
                'verbose_name':'System Disk'
270
            },
271
            'cyclades.ram': {
272
                'help_text':'RAM used by VMs ',
273
                'help_text_input_each':'This is the total amount of RAM that will be granted to each user of this Project (on all VMs)  ',
274
                'is_abbreviation':True,
275
                'report_desc':'RAM',
276
                'placeholder':'eg. 4GB',
277
                'verbose_name':'ram'
278
            },
279
            'cyclades.cpu': {
280
                'help_text':'CPUs used by VMs ',
281
                'help_text_input_each':'This is the total number of CPUs that will be granted to each user of this Project (on all VMs)  ',
282
                'is_abbreviation':True,
283
                'report_desc':'CPUs',
284
                'placeholder':'eg. 1',
285
                'verbose_name':'cpu'
286
            },
287
            'cyclades.vm': {
288
                'help_text':'These are the VMs one can create on the Cyclades UI ',
289
                'help_text_input_each':'This is the total number of VMs that will be granted to each user of this Project ',
290
                'is_abbreviation':True,
291
                'report_desc':'Virtual Machines',
292
                'placeholder':'eg. 2',
293
                'verbose_name':'vm',
294
            },
295
            'cyclades.network.private': {
296
                'help_text':'These are the Private Networks one can create on the Cyclades UI. ',
297
                'help_text_input_each':'This is the total number of Private Networks that will be granted to each user of this Project ',
298
                'is_abbreviation':False,
299
                'report_desc':'Private Networks',
300
                'placeholder':'eg. 1',
301
                'verbose_name':'private network'
302
            }
303

    
304
        },
305

    
306
        'groups_order': ['storage', 'compute', 'network'],
307
        'resources_order': ['pithos+.diskspace', 'cyclades.disk',
308
                            'cyclades.cpu', 'cyclades.ram', 'cyclades.vm',
309
                            'cyclades.network.private']
310

    
311
    })
312

    
313
# Permit local account migration
314
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
315

    
316
# Strict shibboleth usage
317
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
318
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
319
                                       False)
320

    
321
PROJECT_MEMBER_JOIN_POLICIES = getattr(settings,
322
                                'ASTAKOS_PROJECT_MEMBER_JOIN_POLICIES',
323
                                {'1':'automatically accepted',
324
                                 '2':'owner accepts',
325
                                 '3':'closed'})
326

    
327
PROJECT_MEMBER_LEAVE_POLICIES = getattr(settings,
328
                                'ASTAKOS_PROJECT_MEMBER_LEAVE_POLICIES',
329
                                {'1':'automatically accepted',
330
                                 '2':'owner accepts',
331
                                 '3':'closed'})
332

    
333
ACTIVATION_REDIRECT_URL = getattr(settings,
334
                                  'ASTAKOS_ACTIVATION_REDIRECT_URL',
335
                                  "/im/landing")
336

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

    
341
# Users that can approve or deny project applications from the web.
342
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
343

    
344
# Maximum pending project applications per applicant.
345
# This is to reduce the volume of applications
346
# in case users abuse the mechanism.
347
PENDING_APPLICATION_LIMIT = getattr(settings,
348
                                    'ASTAKOS_PENDING_APPLICATION_LIMIT', 1)
349

    
350
# OAuth2 Twitter credentials.
351
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
352
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
353
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
354
                                  False)
355

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

    
360
# OAuth2 LinkedIn credentials.
361
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
362
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
363

    
364
# Where to redirect the user after successful login when no next parameter is
365
# set
366
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
367
                            '/im/landing')