Projet

Général

Profil

0001-profile-give-is_authenticated-is_anonymous-methods-t.patch

Frédéric Péters, 29 mars 2019 17:22

Télécharger (1,19 ko)

Voir les différences:

Subject: [PATCH] profile: give is_authenticated/is_anonymous methods to
 proxied user (#31858)

 combo/profile/utils.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
combo/profile/utils.py
17 17
from django.conf import settings
18 18
from django.contrib.auth.models import User
19 19

  
20
import django
21
if django.VERSION < (1, 11, 0):
22
    CallableFalse, CallableTrue = False, True
23
else:
24
    from django.utils.deprecation import CallableFalse, CallableTrue
20 25

  
21 26
if 'mellon' in settings.INSTALLED_APPS:
22 27
    from mellon.models import UserSAMLIdentifier
......
32 37
    def get_name_id(self):
33 38
        return self.name_id
34 39

  
40
    def is_authenticated(self):
41
        return CallableTrue
42

  
43
    def is_anonymous(self):
44
        return CallableFalse
45

  
35 46

  
36 47
def get_user_from_name_id(name_id, raise_on_missing=False):
37 48
    if not UserSAMLIdentifier:
38
-