Pman/Login.php
[Pman.Base] / Pman / Login.php
index f287ac5..37dd7df 100644 (file)
@@ -129,6 +129,17 @@ class Pman_Login extends Pman
         if (!$this->authUser || ($this->authUser->company_id_comptype != 'OWNER') || !$this->hasPerm('Core.Person', 'E')) {
             $this->jerr("User switching not permitted");
         }
+        $old = clone($this->authUser);
+        $tbl = empty($ff->Pman['authTable']) ? 'Person' : $ff->Pman['authTable'];
+        $u = DB_DataObject::factory($tbl);
+        $u->get($id);
+        if (!$u->active()) {
+            $this->jerr('Account disabled');
+        }
+        $u->login();
+            // we might need this later..
+        $this->addEvent("SWITCH USER", false, $old->name . ' TO ' . $u->name);
+        
         
     }