Statistics
| Branch: | Tag: | Revision:

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

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

    
5
BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
6
                   'https://accounts.example.synnefo.org')
7

    
8

    
9
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
10

    
11
ACCOUNTS_PREFIX = getattr(settings, 'ASTAKOS_ACCOUNTS_PREFIX', 'accounts')
12
VIEWS_PREFIX = getattr(settings, 'ASTAKOS_VIEWS_PREFIX', 'im')
13
KEYSTONE_PREFIX = getattr(settings, 'ASTAKOS_ACCOUNTS_PREFIX', 'keystone')
14

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

    
19
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
20

    
21
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
22
    0: 100,
23
    1: 2,
24
    2: 0,
25
    3: 0,
26
    4: 0
27
})
28

    
29
ADMINS = tuple(getattr(settings, 'ADMINS', ()))
30
MANAGERS = tuple(getattr(settings, 'MANAGERS', ()))
31
HELPDESK = tuple(getattr(settings, 'HELPDESK', ()))
32

    
33
CONTACT_EMAIL = settings.CONTACT_EMAIL
34
SERVER_EMAIL = settings.SERVER_EMAIL
35
SECRET_KEY = settings.SECRET_KEY
36
SESSION_ENGINE = settings.SESSION_ENGINE
37

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

    
42
# Force user profile verification
43
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', False)
44

    
45
#Enable invitations
46
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
47

    
48
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
49
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
50
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
51

    
52
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
53

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

    
58
# Set baseurl
59
BASEURL = getattr(settings, 'ASTAKOS_BASE_URL', 'https://accounts.example.synnefo.org')
60

    
61
# Set service name
62
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME)
63

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

    
72
# Set where the user should be redirected after logout
73
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
74

    
75
# Set user email patterns that are automatically activated
76
RE_USER_EMAIL_PATTERNS = getattr(
77
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
78

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

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

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

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

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

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

    
103
# If False the email change mechanism is disabled
104
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
105

    
106
# Set the expiration time (in days) of email change requests
107
EMAILCHANGE_ACTIVATION_DAYS = getattr(
108
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
109

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

    
114
# Set how many objects should be displayed per page
115
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 50)
116

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

    
120
# Enforce token renewal on password change/reset
121
NEWPASSWD_INVALIDATE_TOKEN = getattr(
122
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
123

    
124
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
125

    
126
# Permit local account migration
127
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
128

    
129
# Strict shibboleth usage
130
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
131
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
132
                                       False)
133

    
134
ACTIVATION_REDIRECT_URL = getattr(settings,
135
                                  'ASTAKOS_ACTIVATION_REDIRECT_URL',
136
                                  "/im/landing")
137

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

    
142
# Users that can approve or deny project applications from the web.
143
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
144

    
145
# OAuth2 Twitter credentials.
146
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
147
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
148
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
149
                                  False)
150

    
151
# OAuth2 Google credentials.
152
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '')
153
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
154

    
155
# OAuth2 LinkedIn credentials.
156
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
157
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
158

    
159
# URL to redirect the user after successful login when no next parameter is set
160
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL','/im/landing')
161

    
162
# Whether or not to display projects in astakos menu
163
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False)
164

    
165
# A way to extend the services presentation metadata
166
SERVICES_META = getattr(settings, 'ASTAKOS_SERVICES_META', {})
167

    
168
# A way to extend the resources presentation metadata
169
RESOURCES_META = getattr(settings, 'ASTAKOS_RESOURCES_META', {})
170

    
171
# Do not require email verification for new users
172
SKIP_EMAIL_VERIFICATION = getattr(settings,
173
                                  'ASTAKOS_SKIP_EMAIL_VERIFICATION', False)