diff options
author | Christian Schneider | 2020-06-23 17:15:06 +0200 |
---|---|---|
committer | Christian Schneider | 2020-06-23 17:15:49 +0200 |
commit | 5c26a69b002b7f66b95ae4a0da0d7ed0b9490fb1 (patch) | |
tree | 3319482a796ad53b1af906fc5377f4d9d2bdaca4 | |
parent | d486ecf93f66eff6586a4893ab3108a4fb352e82 (diff) | |
download | itools-5c26a69b002b7f66b95ae4a0da0d7ed0b9490fb1.tar.gz itools-5c26a69b002b7f66b95ae4a0da0d7ed0b9490fb1.tar.bz2 itools-5c26a69b002b7f66b95ae4a0da0d7ed0b9490fb1.zip |
Remove usage of _read_post_process in it_user
-rw-r--r-- | it_user.class | 24 |
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 |