profile: give is_authenticated/is_anonymous methods to proxied user (#31858)
This commit is contained in:
parent
6195b156b3
commit
77b5977c1f
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue