summaryrefslogtreecommitdiff
path: root/it_user.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_user.class')
-rw-r--r--it_user.class24
1 files changed, 12 insertions, 12 deletions
diff --git a/it_user.class b/it_user.class
index 7c6a56d..7ebdc9f 100644
--- a/it_user.class
+++ b/it_user.class
@@ -79,12 +79,11 @@ function __construct($p = array())
}
/**
- * Post processing, called by ITools after reading a database record
- * @access private
+ * Minimalistic post processing to fill uid and username fields after calling read() on it_user
*/
-function _read_post_process()
+function read($id = null)
{
- parent::_read_post_process();
+ $result = parent::read($id);
# If read succeeded, get UID. This is necessary because it's only set if a cookie is present (i.e. in web-context)
if (isset($this->{$this->p['uid_field']}))
@@ -92,6 +91,15 @@ function _read_post_process()
# Get username from database field (shortcut)
$this->username = $this->{$this->p['username_field']};
+
+ # username == uid means we don't have a username yet
+ if ($this->username == $this->uid) # FIXME 2020-12 CS Remove support for legacy user records with username = uid
+ {
+ it::error(['to' => 'schneider@search.ch', 'title' => "Legacy user record with username = uid ($this->uid)"]);
+ $this->username = "";
+ }
+
+ return $result;
}
@@ -160,18 +168,10 @@ function get_status()
$this->status = IT_USER_STATUS_SESSION;
$this->_set_uid($this->session->get_uid());
$this->read($this->uid);
-
- # username == uid means we don't have a username yet
- if ($this->username == $this->uid)
- $this->username = "";
}
else if (isset($_COOKIE[$this->p['uidcookiename']]) && ($this->uid = substr($_COOKIE[$this->p['uidcookiename']], 0, 32)))
{
@$this->read($this->uid);
-
- if ($this->username == $this->uid)
- $this->username = "";
-
$this->status = $this->username ? IT_USER_STATUS_KNOWN : IT_USER_STATUS_ANONYMOUS;
}
else