Projet

Général

Profil

0001-phone-don-t-use-SSO-username-as-an-line-by-default-1.patch

Thomas Noël, 31 mai 2017 23:56

Télécharger (2,12 ko)

Voir les différences:

Subject: [PATCH] phone: don't use SSO username as an line by default (#16648)

 welco/settings.py            |  2 ++
 welco/sources/phone/views.py | 11 ++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
welco/settings.py
201 201
# phone system
202 202
ONE_CALL_PER_CALLEE = True
203 203
MAX_CALL_DURATION = 0  # in minutes, 0 stands for infinity
204
# if user is from SSO, consider username as a phone line and take it
205
PHONELINE_TAKE_MELLON_USERNAME = False
204 206

  
205 207
# enable/disable specific features
206 208
# ex: FLAVOURS = ['alfortville']
welco/sources/phone/views.py
52 52
    template_name = 'welco/phone_home.html'
53 53

  
54 54
    def get_context_data(self, **kwargs):
55
        username = self.request.session.get('mellon_session', {}).get('username')
56
        if username:
57
            # user is from SSO, username is a phone line (callee), create a link to it
58
            username = username[0].split('@', 1)[0][:80] # remove realm
55
        if settings.PHONELINE_TAKE_MELLON_USERNAME:
56
            username = self.request.session.get('mellon_session', {}).get('username')
59 57
            if username:
60
                PhoneLine.take(callee=username, user=self.request.user)
58
                # user is from SSO, username is a phone line (callee), create a link to it
59
                username = username[0].split('@', 1)[0][:80] # remove realm
60
                if username:
61
                    PhoneLine.take(callee=username, user=self.request.user)
61 62
        context = super(PhoneZone, self).get_context_data(**kwargs)
62 63
        context['source_type'] = ContentType.objects.get_for_model(PhoneCall)
63 64
        context['phonelines'] = PhoneLine.objects.filter(users__id=self.request.user.id)
64
-