Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 8fb8d0cf

History | View | Annotate | Download (7.9 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',
76
                             'custom_theme_widget': 'okeanos_recaptcha'})
77
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True)
78
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False)
79

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

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

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

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

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

    
102
# Messages to display on all pages
103
# e.g. {'warning':
104
#       'This warning message will be displayed on the top of every page'}
105
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', [])
106

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

    
111
# The number of unsuccessful login requests per minute allowed
112
# for a specific user
113
RATELIMIT_RETRIES_ALLOWED = getattr(
114
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
115

    
116
# If False the email change mechanism is disabled
117
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
118

    
119
# Set the expiration time (in days) of email change requests
120
EMAILCHANGE_ACTIVATION_DAYS = getattr(
121
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
122

    
123
# Set the astakos main functions logging severity (None to disable)
124
from logging import INFO
125
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
126

    
127
# Set how many objects should be displayed per page
128
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50)
129

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

    
133
# Enforce token renewal on password change/reset
134
NEWPASSWD_INVALIDATE_TOKEN = getattr(
135
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
136

    
137
USAGE_UPDATE_INTERVAL = getattr(
138
    settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
139

    
140
# Permit local account migration
141
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(
142
    settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
143

    
144
# Strict shibboleth usage
145
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
146
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
147
                                       False)
148

    
149
default_activation_redirect_url = join_urls('/', BASE_PATH, VIEWS_PREFIX,
150
                                            "landing")
151
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
152
                                  default_activation_redirect_url)
153

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

    
158
# Users that can approve or deny project applications from the web.
159
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
160

    
161
# OAuth2 Twitter credentials.
162
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
163
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
164
TWITTER_AUTH_FORCE_LOGIN = getattr(
165
    settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN', False)
166

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

    
171
# OAuth2 LinkedIn credentials.
172
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
173
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
174

    
175
# URL to redirect the user after successful login when no next parameter is set
176
default_success_url = join_urls('/', BASE_PATH, VIEWS_PREFIX, "landing")
177
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
178
                            default_success_url)
179

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

    
183
# A way to extend the components presentation metadata
184
COMPONENTS_META = getattr(settings, 'ASTAKOS_COMPONENTS_META', {})
185

    
186
# A way to extend the resources presentation metadata
187
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
188

    
189
# Do not require email verification for new users
190
SKIP_EMAIL_VERIFICATION = getattr(settings,
191
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)
192

    
193
# Kamaki download url. Displayed in api access view
194
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL',
195
                         'https://pypi.python.org/pypi/kamaki')
196

    
197
KAMAKI_CONFIG_CLOUD_NAME = getattr(settings,
198
                                   'ASTAKOS_KAMAKI_CONFIG_CLOUD_NAME',
199
                                   None)