Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (9.8 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
ADMINS = getattr(settings, 'ADMINS', ())
19
MANAGERS = getattr(settings, 'MANAGERS', ADMINS)
20
HELPDESK = getattr(settings, 'HELPDESK', ADMINS)
21

    
22
CONTACT_EMAIL = settings.CONTACT_EMAIL
23
SERVER_EMAIL = settings.SERVER_EMAIL
24
SECRET_KEY = settings.SECRET_KEY
25
SESSION_ENGINE = settings.SESSION_ENGINE
26

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

    
31
# Force user profile verification
32
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False)
33

    
34
#Enable invitations
35
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
36

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

    
41
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
42

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

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

    
50
# Set service name
51
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME)
52

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

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

    
64
# Queue for billing.
65
# Example: 'rabbitmq://guest:guest@localhost:5672/astakos'
66
QUEUE_CONNECTION = getattr(settings, 'ASTAKOS_QUEUE_CONNECTION', None)  
67
# Set where the user should be redirected after logout
68
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
69

    
70
# Set user email patterns that are automatically activated
71
RE_USER_EMAIL_PATTERNS = getattr(
72
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
73

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

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

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

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

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

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

    
98
# If False the email change mechanism is disabled
99
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
100

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

    
105
# Set the astakos main functions logging severity (None to disable)
106
from logging import INFO
107
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
108

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

    
163
# Set how many objects should be displayed per page
164
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)
165

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

    
169
# Enforce token renewal on password change/reset
170
NEWPASSWD_INVALIDATE_TOKEN = getattr(
171
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
172

    
173
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
174

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

    
178
# Strict shibboleth usage
179
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
180
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
181
                                       False)
182

    
183
ACTIVATION_REDIRECT_URL = getattr(settings,
184
                                  'ASTAKOS_ACTIVATION_REDIRECT_URL',
185
                                  "/im/landing")
186

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

    
191
# Users that can approve or deny project applications from the web.
192
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
193

    
194
# Maximum pending project applications per applicant.
195
# This is to reduce the volume of applications
196
# in case users abuse the mechanism.
197
PENDING_APPLICATION_LIMIT = getattr(settings,
198
                                    'ASTAKOS_PENDING_APPLICATION_LIMIT', 0)
199

    
200
# OAuth2 Twitter credentials.
201
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
202
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
203
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
204
                                  False)
205

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

    
210
# OAuth2 LinkedIn credentials.
211
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
212
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
213

    
214
# URL to redirect the user after successful login when no next parameter is set
215
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL','/im/landing')
216

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

    
220
# A way to extend the services presentation metadata
221
SERVICES_META = getattr(settings, 'ASTAKOS_SERVICES_META', {})
222

    
223
# A way to extend the resources presentation metadata
224
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
225

    
226
# Do not require email verification for new users
227
SKIP_EMAIL_VERIFICATION = getattr(settings,
228
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)