Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 484a79a1

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

    
7

    
8
BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
9
                   'https://accounts.example.synnefo.org')
10

    
11

    
12
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
13

    
14
ACCOUNTS_PREFIX = get_path(astakos_services, 'astakos_account.prefix')
15
VIEWS_PREFIX = get_path(astakos_services, 'astakos_ui.prefix')
16
KEYSTONE_PREFIX = get_path(astakos_services, 'astakos_keystone.prefix')
17

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

    
22
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
23

    
24
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
25
    0: 100,
26
    1: 2,
27
    2: 0,
28
    3: 0,
29
    4: 0
30
})
31

    
32
ADMINS = tuple(getattr(settings, 'ADMINS', ()))
33
MANAGERS = tuple(getattr(settings, 'MANAGERS', ()))
34
HELPDESK = tuple(getattr(settings, 'HELPDESK', ()))
35

    
36
CONTACT_EMAIL = settings.CONTACT_EMAIL
37
SERVER_EMAIL = settings.SERVER_EMAIL
38
SECRET_KEY = settings.SECRET_KEY
39
SESSION_ENGINE = settings.SESSION_ENGINE
40

    
41
# Identity Management enabled modules
42
# Supported modules are: 'local', 'twitter' and 'shibboleth'
43
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
44

    
45
# Force user profile verification
46
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False)
47

    
48
#Enable invitations
49
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
50

    
51
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
52
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
53
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
54

    
55
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
56

    
57
# If set to False and invitations not enabled newly created user
58
# will be automatically accepted
59
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True)
60

    
61
# Set baseurl
62
BASEURL = getattr(settings, 'ASTAKOS_BASE_URL', 'https://accounts.example.synnefo.org')
63

    
64
# Set service name
65
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME)
66

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

    
75
# Set where the user should be redirected after logout
76
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
77

    
78
# Set user email patterns that are automatically activated
79
RE_USER_EMAIL_PATTERNS = getattr(
80
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
81

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

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

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

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

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

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

    
106
# If False the email change mechanism is disabled
107
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
108

    
109
# Set the expiration time (in days) of email change requests
110
EMAILCHANGE_ACTIVATION_DAYS = getattr(
111
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
112

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

    
117
# Set how many objects should be displayed per page
118
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50)
119

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

    
123
# Enforce token renewal on password change/reset
124
NEWPASSWD_INVALIDATE_TOKEN = getattr(
125
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
126

    
127
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
128

    
129
# Permit local account migration
130
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
131

    
132
# Strict shibboleth usage
133
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
134
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
135
                                       False)
136

    
137
default_redirect_url = join_urls(ASTAKOS_BASE_URL, VIEWS_PREFIX, "landing")
138
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
139
                                  default_redirect_url)
140

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

    
145
# Users that can approve or deny project applications from the web.
146
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
147

    
148
# OAuth2 Twitter credentials.
149
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
150
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
151
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
152
                                  False)
153

    
154
# OAuth2 Google credentials.
155
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '')
156
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
157

    
158
# OAuth2 LinkedIn credentials.
159
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
160
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
161

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

    
167
# Whether or not to display projects in astakos menu
168
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False)
169

    
170
# A way to extend the services presentation metadata
171
SERVICES_META = getattr(settings, 'ASTAKOS_SERVICES_META', {})
172

    
173
# A way to extend the resources presentation metadata
174
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
175

    
176
# Do not require email verification for new users
177
SKIP_EMAIL_VERIFICATION = getattr(settings,
178
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)