users: make is_authenticated/is_anonymous properties (#64494)
This commit is contained in:
parent
683a681b28
commit
9d3fd54a61
26
wcs/users.py
26
wcs/users.py
|
@ -303,20 +303,26 @@ class User(StorableObject):
|
|||
data['NameID'] = self.name_identifiers
|
||||
return data
|
||||
|
||||
# django-compatibility methods, useful in templates
|
||||
def is_anonymous(self):
|
||||
return self.anonymous
|
||||
|
||||
def is_authenticated(self):
|
||||
return not (self.anonymous)
|
||||
|
||||
def get_full_name(self):
|
||||
return self.display_name
|
||||
|
||||
def set_deleted(self):
|
||||
self.deleted_timestamp = datetime.datetime.now()
|
||||
self.store()
|
||||
|
||||
# django-compatibility properties and methods, useful in shared code/templates
|
||||
@property
|
||||
def is_anonymous(self):
|
||||
return self.anonymous
|
||||
|
||||
@property
|
||||
def is_authenticated(self):
|
||||
return not (self.anonymous)
|
||||
|
||||
@property
|
||||
def is_superuser(self):
|
||||
return self.is_admin
|
||||
|
||||
def get_full_name(self):
|
||||
return self.display_name
|
||||
|
||||
|
||||
Substitutions.register(
|
||||
'session_user_display_name',
|
||||
|
|
Loading…
Reference in New Issue