summaryrefslogtreecommitdiff
path: root/src/models/Auth.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/Auth.class.php')
-rw-r--r--src/models/Auth.class.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/models/Auth.class.php b/src/models/Auth.class.php
index f2c9120..975c25f 100644
--- a/src/models/Auth.class.php
+++ b/src/models/Auth.class.php
@@ -9,19 +9,19 @@ class Auth {
public static function getObj($uid) {
if (!isset(self::$users[$uid])) {
global $mm;
- $is_group = ($mm->database()->getStatus($uid)===3);
- if ($is_group) {
- require_once('Group.class.php');
- $obj = new Group($uid);
- } else {
- require_once('User.class.php');
- $obj = new User($uid);
+ $type = $mm->database()->getStatus($uid)<3;
+ switch ($type) {
+ case 0: // unactivated user
+ case 1: // user
+ case 2: $obj = new User($uid); // admin
+ case 3: $obj = new Group($uid);
+ case 4: $obj = new Auth($uid); // deleted
}
self::$users[$uid] = $obj;
}
return self::$users[$uid];
}
-
+
protected $db = null;
protected $uid = false;
public function __construct($uid) {
@@ -39,7 +39,7 @@ class Auth {
// Row Type ////////////////////////////////////////////////////////////
/**
- * @return 0=unverified 1=user 2=admin 3=group
+ * @return 0=unverified 1=user 2=admin 3=group 4=deleted
*/
protected function getType() {
$type = $this->db->getStatus($this->uid);
@@ -75,6 +75,9 @@ class Auth {
$is_user = $this->isUser();
$this->setType($is_admin?2:($is_user?1:0));
}
+ public function delete() {
+ $this->setType(4);
+ }
// Permissions /////////////////////////////////////////////////////////
public function canRead() {