RooTrait.php
authoredward <edward@roojs.com>
Wed, 30 Mar 2016 10:30:59 +0000 (18:30 +0800)
committeredward <edward@roojs.com>
Wed, 30 Mar 2016 10:30:59 +0000 (18:30 +0800)
RooTrait.php

index c9de7c4..26057e6 100644 (file)
@@ -366,8 +366,23 @@ trait Pman_Core_RooTrait {
         
         $e->onInsert(isset($_REQUEST) ? $_REQUEST : array() , $this);
         
-       
         return $e;
         
     }
+    
+    function getAuthUser()
+    {
+        if (!empty($this->authUser)) {
+            return $this->authUser;
+        }
+        $ff = HTML_FlexyFramework::get();
+        $tbl = empty($ff->Pman['authTable']) ? 'Person' : $ff->Pman['authTable'];
+        
+        $u = DB_DataObject::factory( $tbl );
+        if (!$u->isAuth()) {
+            return false;
+        }
+        $this->authUser =$u->getAuthUser();
+        return $this->authUser ;
+    }
 }