From 77b5977c1f54511f1ca9a7e4726eefdaa1666e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 29 Mar 2019 17:10:07 +0100 Subject: [PATCH] profile: give is_authenticated/is_anonymous methods to proxied user (#31858) --- combo/profile/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/combo/profile/utils.py b/combo/profile/utils.py index 11ba3e58..357cccfb 100644 --- a/combo/profile/utils.py +++ b/combo/profile/utils.py @@ -17,6 +17,11 @@ from django.conf import settings from django.contrib.auth.models import User +import django +if django.VERSION < (1, 11, 0): + CallableFalse, CallableTrue = False, True +else: + from django.utils.deprecation import CallableFalse, CallableTrue if 'mellon' in settings.INSTALLED_APPS: from mellon.models import UserSAMLIdentifier @@ -32,6 +37,12 @@ class ProxiedUser(object): def get_name_id(self): return self.name_id + def is_authenticated(self): + return CallableTrue + + def is_anonymous(self): + return CallableFalse + def get_user_from_name_id(name_id, raise_on_missing=False): if not UserSAMLIdentifier: