root / snf-astakos-app / astakos / im / settings.py @ 6c7af65c
History | View | Annotate | Download (7.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 |
5 |
from synnefo.util.keypath import get_path |
6 |
from synnefo.lib import join_urls |
7 |
|
8 |
|
9 |
BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL', |
10 |
'https://accounts.example.synnefo.org')
|
11 |
|
12 |
|
13 |
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL) |
14 |
|
15 |
ACCOUNTS_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
|
16 |
VIEWS_PREFIX = get_path(astakos_services, 'astakos_ui.prefix')
|
17 |
KEYSTONE_PREFIX = get_path(astakos_services, 'astakos_keystone.prefix')
|
18 |
|
19 |
# Set the expiration time of newly created auth tokens
|
20 |
# to be this many hours after their creation time.
|
21 |
AUTH_TOKEN_DURATION = getattr(settings, 'ASTAKOS_AUTH_TOKEN_DURATION', 30 * 24) |
22 |
|
23 |
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4) |
24 |
|
25 |
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', { |
26 |
0: 100, |
27 |
1: 2, |
28 |
2: 0, |
29 |
3: 0, |
30 |
4: 0 |
31 |
}) |
32 |
|
33 |
ADMINS = tuple(getattr(settings, 'ADMINS', ())) |
34 |
MANAGERS = tuple(getattr(settings, 'MANAGERS', ())) |
35 |
HELPDESK = tuple(getattr(settings, 'HELPDESK', ())) |
36 |
|
37 |
CONTACT_EMAIL = settings.CONTACT_EMAIL |
38 |
SERVER_EMAIL = settings.SERVER_EMAIL |
39 |
SECRET_KEY = settings.SECRET_KEY |
40 |
SESSION_ENGINE = settings.SESSION_ENGINE |
41 |
|
42 |
# Identity Management enabled modules
|
43 |
# Supported modules are: 'local', 'twitter' and 'shibboleth'
|
44 |
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local']) |
45 |
|
46 |
# Force user profile verification
|
47 |
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False) |
48 |
|
49 |
#Enable invitations
|
50 |
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False) |
51 |
|
52 |
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a') |
53 |
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None) |
54 |
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True) |
55 |
|
56 |
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/') |
57 |
|
58 |
# If set to False and invitations not enabled newly created user
|
59 |
# will be automatically accepted
|
60 |
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True) |
61 |
|
62 |
# Set service name
|
63 |
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME) |
64 |
|
65 |
# Set recaptcha keys
|
66 |
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '') |
67 |
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '') |
68 |
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS', |
69 |
{'theme': 'custom', 'custom_theme_widget': 'okeanos_recaptcha'}) |
70 |
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True) |
71 |
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False) |
72 |
|
73 |
# Set where the user should be redirected after logout
|
74 |
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '') |
75 |
|
76 |
# Set user email patterns that are automatically activated
|
77 |
RE_USER_EMAIL_PATTERNS = getattr(
|
78 |
settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
|
79 |
|
80 |
# Messages to display on login page header
|
81 |
# e.g. {'warning': 'This warning message will be displayed on the top of login page'}
|
82 |
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', []) |
83 |
|
84 |
# Messages to display on login page header
|
85 |
# e.g. {'warning': 'This warning message will be displayed on the top of signup page'}
|
86 |
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', []) |
87 |
|
88 |
# Messages to display on login page header
|
89 |
# e.g. {'warning': 'This warning message will be displayed on the top of profile page'}
|
90 |
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', []) |
91 |
|
92 |
# Messages to display on all pages
|
93 |
# e.g. {'warning': 'This warning message will be displayed on the top of every page'}
|
94 |
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', []) |
95 |
|
96 |
# messages to display as extra actions in account forms
|
97 |
# e.g. {'https://www.myhomepage.com': 'Back to <service_name>'}
|
98 |
PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {}) |
99 |
|
100 |
# The number of unsuccessful login requests per minute allowed for a specific user
|
101 |
RATELIMIT_RETRIES_ALLOWED = getattr(
|
102 |
settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3) |
103 |
|
104 |
# If False the email change mechanism is disabled
|
105 |
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False) |
106 |
|
107 |
# Set the expiration time (in days) of email change requests
|
108 |
EMAILCHANGE_ACTIVATION_DAYS = getattr(
|
109 |
settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10) |
110 |
|
111 |
# Set the astakos main functions logging severity (None to disable)
|
112 |
from logging import INFO |
113 |
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO) |
114 |
|
115 |
# Set how many objects should be displayed per page
|
116 |
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50) |
117 |
|
118 |
# Set how many objects should be displayed per page in show all projects page
|
119 |
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 50) |
120 |
|
121 |
# Enforce token renewal on password change/reset
|
122 |
NEWPASSWD_INVALIDATE_TOKEN = getattr(
|
123 |
settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True) |
124 |
|
125 |
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000) |
126 |
|
127 |
# Permit local account migration
|
128 |
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True) |
129 |
|
130 |
# Strict shibboleth usage
|
131 |
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
|
132 |
'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
|
133 |
False)
|
134 |
|
135 |
default_redirect_url = join_urls(BASE_URL, VIEWS_PREFIX, "landing")
|
136 |
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL', |
137 |
default_redirect_url) |
138 |
|
139 |
# If true, this enables a ui compatibility layer for the introduction of UUIDs
|
140 |
# in identity management. WARNING: Setting to True will break your installation.
|
141 |
TRANSLATE_UUIDS = getattr(settings, 'ASTAKOS_TRANSLATE_UUIDS', False) |
142 |
|
143 |
# Users that can approve or deny project applications from the web.
|
144 |
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set()) |
145 |
|
146 |
# OAuth2 Twitter credentials.
|
147 |
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '') |
148 |
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '') |
149 |
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN', |
150 |
False)
|
151 |
|
152 |
# OAuth2 Google credentials.
|
153 |
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '') |
154 |
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '') |
155 |
|
156 |
# OAuth2 LinkedIn credentials.
|
157 |
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '') |
158 |
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '') |
159 |
|
160 |
# URL to redirect the user after successful login when no next parameter is set
|
161 |
default_success_url = join_urls(BASE_URL, VIEWS_PREFIX, "landing")
|
162 |
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL', |
163 |
default_redirect_url) |
164 |
|
165 |
# Whether or not to display projects in astakos menu
|
166 |
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False) |
167 |
|
168 |
# A way to extend the services presentation metadata
|
169 |
SERVICES_META = getattr(settings, 'ASTAKOS_SERVICES_META', {}) |
170 |
|
171 |
# A way to extend the resources presentation metadata
|
172 |
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {}) |
173 |
|
174 |
# Do not require email verification for new users
|
175 |
SKIP_EMAIL_VERIFICATION = getattr(settings,
|
176 |
'ASTAKOS_SKIP_EMAIL_VERIFICATION', False) |