Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (7.4 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_keystone.prefix')
23

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
130
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
131

    
132
# Permit local account migration
133
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
134

    
135
# Strict shibboleth usage
136
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
137
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
138
                                       False)
139

    
140
default_redirect_url = join_urls(BASE_URL, VIEWS_PREFIX, "landing")
141
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
142
                                  default_redirect_url)
143

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

    
148
# Users that can approve or deny project applications from the web.
149
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
150

    
151
# OAuth2 Twitter credentials.
152
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
153
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
154
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
155
                                  False)
156

    
157
# OAuth2 Google credentials.
158
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '')
159
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
160

    
161
# OAuth2 LinkedIn credentials.
162
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
163
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
164

    
165
# URL to redirect the user after successful login when no next parameter is set
166
default_success_url = join_urls(BASE_URL, VIEWS_PREFIX, "landing")
167
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
168
                            default_redirect_url)
169

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

    
173
# A way to extend the components presentation metadata
174
COMPONENTS_META = getattr(settings, 'ASTAKOS_COMPONENTS_META', {})
175

    
176
# A way to extend the resources presentation metadata
177
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
178

    
179
# Do not require email verification for new users
180
SKIP_EMAIL_VERIFICATION = getattr(settings,
181
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)