summaryrefslogtreecommitdiffstats
path: root/src/authentic2_cut/custom_settings.py
blob: 50d7a85ac15375baf8bf4f7873740da34f237e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# -*- coding: utf-8 -*-
from authentic2.settings import INSTALLED_APPS, CACHES
import os

PLATFORM = os.environ.get('PLATFORM')
if PLATFORM not in ['dev', 'test', 'prod']:
    PLATFORM = 'dev'

CORE_ATTRIBUTES = [
    'title',
    'first_name',
    'last_name',
    'birthdate',
    'birthplace',
    'birthcountry'
]

CROWN_ATTRIBUTES = [
    'preferred_username',
    'preferred_givenname',
    'address_number',
    'address_street',
    'address_complement',
    'address_zipcode',
    'address_city',
    'address_country',
    'home_mobile_phone',
    'home_phone',
    'professional_mobile_phone',
    'professional_phone',
    'birthdepartment'
]

# Manager
A2_MANAGER_SHOW_INTERNAL_ROLES = True
A2_MANAGER_ROLE_MEMBERS_FROM_OU = True
A2_MANAGER_USER_SEARCH_MINIMUM_CHARS = 2
A2_MANAGER_ROLES_SHOW_PERMISSIONS = True
A2_MANAGER_ROLE_MEMBERS_FROM_OU = True


A2_REQUIRED_FIELDS = ['email', 'first_name', 'last_name']
A2_PRE_REGISTRATION_FIELDS = ['first_name', 'last_name']

A2_RBAC_MANAGED_CONTENT_TYPES = ()
A2_CUT_PARTNERS = [
    {
        'domains': ['.lyon.fr'],
        'name': u'Ville de Lyon',
    },
    {
        'domains': ['.entrouvert.org'],
        'name': u'Ville de Lyon',
    }
]

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

# 48h pour les mails de reset de mot de passe
PASSWORD_RESET_TIMEOUT_DAYS = 2
A2_EMAIL_CHANGE_TOKEN_LIFETIME = 3600 * 24 * 2
ACCOUNT_ACTIVATION_DAYS = 2


# CACHALOT_UNCACHABLE_TABLES = ('custom_user_user', 'django_migrations')

# OIDC
A2_IDP_OIDC_SCOPES = ['openid', 'email', 'profile', 'crown']

A2_FC_USER_INFO_MAPPINGS = {
    'first_name': 'given_name',
    'last_name': 'family_name',
    'birthdate': {'ref': 'birthdate', 'translation': 'isodate'},
    'birthplace': {'ref': 'birthplace', 'translation': 'insee-communes'},
    'birthcountry': {'ref': 'birthcountry', 'translation': 'insee-countries'},
    'birthplace_insee': 'birthplace',
    'birthcountry_insee': 'birthcountry',
    'preferred_username': 'preferred_username',
    'title': {
        'ref': 'gender',
        'translation': 'simple',
        'translation_simple': {
            'male': 'Monsieur',
            'female': 'Madame',
        }
    },
    'address': 'address.formatted',
    'phone': 'phone',
    'email': {
        'ref': 'email',
        'if-empty': True,
        'tag': 'email',
    },
    'email_verified': {
        'ref': 'email',
        'translation': 'notempty',
        'if-tag': 'email',
    },
}

A2_FC_SCOPES = ['openid', 'identite_pivot', 'email', 'address', 'phone']

TEMPLATE_VARS = {
    "email_signature": u"Le GrandLyon",
    "no_extra_js": True,
    "global_title": u"GRANDLYON CONNECT",
    "css_variant": u"grandlyon-cut",
    "theme_color": u"#FF0303",
    "theme": u"grandlyon-cut",
    "default_from_email": u"ne-pas-repondre@grandlyon.com",
    "help_url": 'https://support.grandlyon.com/glc/',
    'theme_base': 'theme.html',
    'theme_base_filename': 'theme.html',
    "account_label": "compte GRANDLYON CONNECT",
    "partners_url": "https://www.grandlyon.com/projets/metropole-intelligente.html",
    "manager_homepage_title": "GRANDLYON CONNECT",
    "manager_homepage_url": "/manage/",
}
if PLATFORM == 'dev':
    TEMPLATE_VARS.update({
        "environment_label": u"Site de développement",
        "moncompte_url": 'https://connexion-grandlyon.dev.entrouvert.org',
    })
elif PLATFORM == 'test':
    TEMPLATE_VARS.update({
        "environment_label": u"Site de test",
        "smarttag_js": "https://tag.aticdn.net/586793/smarttag.js",
        "visits_tracking_js": "var tag = new ATInternet.Tracker.Tag();",
        "moncompte_url": 'https://moncompte-rec.grandlyon.com',
    })
elif PLATFORM == 'prod':
    TEMPLATE_VARS.update({
        "smarttag_js": "https://tag.aticdn.net/586794/smarttag.js",
        "visits_tracking_js": "var tag = new ATInternet.Tracker.Tag();",
        "moncompte_url": 'https://moncompte.grandlyon.com',
    })

A2_HOMEPAGE_URL = '/accounts/'
A2_MANAGER_SITE_TITLE = 'GRANDLYON CONNECT'
A2_LOGIN_REDIRECT_AUTHENTICATED_USERS_TO_HOMEPAGE = True

from authentic2.settings import DJANGO_RBAC_PERMISSIONS_HIERARCHY

DJANGO_RBAC_PERMISSIONS_HIERARCHY['cut_validate'] = ['view', 'search']
DJANGO_RBAC_PERMISSIONS_HIERARCHY['cut_fc'] = ['view', 'search']