Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (7.7 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
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
132

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

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

    
141
default_activation_redirect_url = join_urls('/', BASE_PATH, VIEWS_PREFIX,
142
                                            "landing")
143
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
144
                                  default_activation_redirect_url)
145

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

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

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

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

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

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

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

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

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

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

    
185
# Kamaki download url. Displayed in api access view
186
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL',
187
                         'https://pypi.python.org/pypi/kamaki')