Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 3f3dc4b7

History | View | Annotate | Download (15.7 kB)

1
from django.conf import settings
2

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

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

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

    
17
ADMINS = getattr(settings, 'ADMINS', ())
18
MANAGERS = getattr(settings, 'MANAGERS', ADMINS)
19
HELPDESK = getattr(settings, 'HELPDESK', ADMINS)
20

    
21
CONTACT_EMAIL = settings.CONTACT_EMAIL
22
SERVER_EMAIL = settings.SERVER_EMAIL
23

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

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

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

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

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

    
40
# If set to False and invitations not enabled newly created user
41
# 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 Cloud')
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
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
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://cms.okeanos.grnet.gr/': 'Back to ~okeanos'}
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 alpha2 testing' % SITENAME)
110
GREETING_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_GREETING_EMAIL_SUBJECT',
111
                                 'Welcome to %s alpha2 testing' % SITENAME)
112
FEEDBACK_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_FEEDBACK_EMAIL_SUBJECT',
113
                                 'Feedback from %s alpha2 testing' % SITENAME)
114
VERIFICATION_EMAIL_SUBJECT = getattr(
115
    settings, 'ASTAKOS_VERIFICATION_EMAIL_SUBJECT',
116
    '%s alpha2 testing account activation is needed' % SITENAME)
117
ACCOUNT_CREATION_SUBJECT = getattr(
118
    settings, 'ASTAKOS_ACCOUNT_CREATION_SUBJECT',
119
    '%s alpha2 testing account created (%%(user)s)' % SITENAME)
120
GROUP_CREATION_SUBJECT = getattr(
121
    settings, 'ASTAKOS_GROUP_CREATION_SUBJECT',
122
    '%s alpha2 testing group created (%%(group)s)' % SITENAME)
123
HELPDESK_NOTIFICATION_EMAIL_SUBJECT = getattr(
124
    settings, 'ASTAKOS_HELPDESK_NOTIFICATION_EMAIL_SUBJECT',
125
    '%s alpha2 testing account activated (%%(user)s)' % SITENAME)
126
EMAIL_CHANGE_EMAIL_SUBJECT = getattr(
127
    settings, 'ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT',
128
    'Email change on %s alpha2 testing' % SITENAME)
129
PASSWORD_RESET_EMAIL_SUBJECT = getattr(
130
    settings, 'ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT',
131
    'Password reset on %s alpha2 testing' % SITENAME)
132
PROJECT_CREATION_SUBJECT = getattr(
133
    settings, 'ASTAKOS_PROJECT_CREATION_SUBJECT',
134
    '%s alpha2 testing project application created (%%(name)s)' % SITENAME)
135
PROJECT_APPROVED_SUBJECT = getattr(
136
    settings, 'ASTAKOS_PROJECT_APPROVED_SUBJECT',
137
    '%s alpha2 testing project application approved (%%(name)s)' % SITENAME)
138
PROJECT_DENIED_SUBJECT = getattr(
139
    settings, 'ASTAKOS_PROJECT_DENIED_SUBJECT',
140
    '%s alpha2 testing project application denied (%%(name)s)' % SITENAME)
141
PROJECT_TERMINATION_SUBJECT = getattr(
142
    settings, 'ASTAKOS_PROJECT_TERMINATION_SUBJECT',
143
    '%s alpha2 testing project terminated (%%(name)s)' % SITENAME)
144
PROJECT_SUSPENSION_SUBJECT = getattr(
145
    settings, 'ASTAKOS_PROJECT_SUSPENSION_SUBJECT',
146
    '%s alpha2 testing project suspended (%%(name)s)' % SITENAME)
147
PROJECT_MEMBERSHIP_CHANGE_SUBJECT = getattr(
148
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_CHANGE_SUBJECT',
149
    '%s alpha2 testing project membership changed (%%(name)s)' % SITENAME)
150
PROJECT_MEMBERSHIP_ENROLL_SUBJECT = getattr(
151
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_ENROLL_SUBJECT',
152
    '%s alpha2 testing project enrollment (%%(name)s)' % SITENAME)
153
PROJECT_MEMBERSHIP_REQUEST_SUBJECT = getattr(
154
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_REQUEST_SUBJECT',
155
    '%s alpha2 testing project membership request (%%(name)s)' % SITENAME)
156
PROJECT_MEMBERSHIP_LEAVE_REQUEST_SUBJECT = getattr(
157
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_LEAVE_REQUEST_SUBJECT',
158
    '%s alpha2 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
QUOTAHOLDER_POOLSIZE = getattr(settings, 'ASTAKOS_QUOTAHOLDER_POOLSIZE', 50)
164

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

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

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

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

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

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

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

    
305
        },
306

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

    
312
    })
313

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

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

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

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

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

    
338

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

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

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

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

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

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

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

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