Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 184f551f

History | View | Annotate | Download (8.2 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 astakosclient 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

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

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

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

    
39
ADMINS = tuple(getattr(settings, 'ADMINS', ()))
40
MANAGERS = tuple(getattr(settings, 'MANAGERS', ()))
41
HELPDESK = tuple(getattr(settings, 'HELPDESK', ()))
42

    
43
CONTACT_EMAIL = settings.CONTACT_EMAIL
44
SERVER_EMAIL = settings.SERVER_EMAIL
45
SECRET_KEY = settings.SECRET_KEY
46
SESSION_ENGINE = settings.SESSION_ENGINE
47

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

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

    
55
#Enable invitations
56
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
57

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

    
62
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
63

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

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

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

    
79
# Set where the user should be redirected after logout
80
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
81

    
82
# Set user email patterns that are automatically activated
83
RE_USER_EMAIL_PATTERNS = getattr(
84
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
85

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

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

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

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

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

    
106
# The number of unsuccessful login requests per minute allowed for a specific user
107
RATELIMIT_RETRIES_ALLOWED = getattr(
108
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
109

    
110
# If False the email change mechanism is disabled
111
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
112

    
113
# Set the expiration time (in days) of email change requests
114
EMAILCHANGE_ACTIVATION_DAYS = getattr(
115
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
116

    
117
# Set the astakos main functions logging severity (None to disable)
118
from logging import INFO
119
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
120

    
121
# Set how many objects should be displayed per page
122
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50)
123

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

    
127
# Enforce token renewal on password change/reset
128
NEWPASSWD_INVALIDATE_TOKEN = getattr(
129
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
130

    
131
# Interval at which to update the user's available quota in astakos usage
132
# profile view
133
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL',
134
                                5000)
135

    
136
# Permit local account migration
137
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
138

    
139
# Strict shibboleth usage
140
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
141
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
142
                                       False)
143

    
144
default_activation_redirect_url = join_urls('/', BASE_PATH, VIEWS_PREFIX,
145
                                            "landing")
146
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
147
                                  default_activation_redirect_url)
148

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

    
153
# Users that can approve or deny project applications from the web.
154
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
155

    
156
# OAuth2 Twitter credentials.
157
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
158
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
159
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
160
                                  False)
161

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

    
166
# OAuth2 LinkedIn credentials.
167
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
168
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
169

    
170
# URL to redirect the user after successful login when no next parameter is set
171
default_success_url = join_urls('/', BASE_PATH, VIEWS_PREFIX, "landing")
172
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
173
                            default_success_url)
174

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

    
178
# A way to extend the components presentation metadata
179
COMPONENTS_META = getattr(settings, 'ASTAKOS_COMPONENTS_META', {})
180

    
181
# A way to extend the resources presentation metadata
182
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
183

    
184
# Do not require email verification for new users
185
SKIP_EMAIL_VERIFICATION = getattr(settings,
186
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)
187

    
188
# Kamaki download url. Displayed in api access view
189
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL',
190
                         'https://pypi.python.org/pypi/kamaki')
191

    
192
KAMAKI_CONFIG_CLOUD_NAME = getattr(settings,
193
                                   'ASTAKOS_KAMAKI_CONFIG_CLOUD_NAME',
194
                                   None)
195

    
196
REDIRECT_ALLOWED_SCHEMES = getattr(settings,
197
                                   'ASTAKOS_REDIRECT_ALLOWED_SCHEMES',
198
                                   ('pithos',))