Skip to content

Commit 65de483

Browse files
committed
Fix user setup
1 parent 7dd5c55 commit 65de483

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/WebApp/DataModel/User.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class User implements \WebApp\Auth\Principal {
1111
public const STATUS_DELETED = 'deleted';
1212

1313
public function __construct() {
14+
$this->created_on = new \TgUtils\Date($this->created_on, WFW_TIMEZONE);
1415
}
1516

1617
/**
@@ -37,11 +38,10 @@ public function passwordCriteriaMatched($password) {
3738
}
3839

3940
public function getRoles() {
40-
$rc = array();
41-
if (is_string($this->roles)) {
42-
$rc = explode(',', $this->roles);
41+
if (!isset($this->_roles)) {
42+
$this->_roles = explode(',', $this->roles);
4343
}
44-
return $rc;
44+
return $this->_roles;
4545
}
4646

4747
public function hasRole($s) {
@@ -59,6 +59,7 @@ public function addRole($s) {
5959
public function setRoles($arr) {
6060
if (is_string($arr)) $this->roles = $arr;
6161
else if (is_array($arr)) $this->roles = implode(',', $arr);
62+
$this->_roles = explode(',', $this->roles);
6263
}
6364

6465
public function isActive() {

src/WebApp/DataModel/UserDAO.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ protected function initialize() {
1919
$sql =
2020
'CREATE TABLE '.$this->database->quoteName($this->tableName).' ('.
2121
'`uid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,'.
22+
'`created_on` DATETIME NOT NULL,'.
2223
'`email` varchar(250) COLLATE utf8mb4_bin NOT NULL,'.
2324
'`password` varchar(150) COLLATE utf8mb4_bin NOT NULL,'.
2425
'`name` varchar(50) COLLATE utf8mb4_bin NOT NULL,'.

0 commit comments

Comments
 (0)