RooTrait.php
[Pman.Core] / RooTrait.php
index 23cbfd9..e84ab79 100644 (file)
@@ -133,8 +133,6 @@ trait Pman_Core_RooTrait {
             return;
         }
         
-        $au = $this->getAuthUser();
-       
         $e = DB_DataObject::factory('Events');
         $e->init($act,$obj,$remarks); 
          
@@ -162,11 +160,21 @@ trait Pman_Core_RooTrait {
         if ($obj->checkPerm($lvl, $this->getAuthUser(), $req))  {
             return true;
         }
+        
         return false;
     }
     
+    function hasPerm($name, $lvl)  // do we have a permission
+    {
+        static $pcache = array();
+        $au = $this->getAuthUser();
+        return $au && $au->hasPerm($name, $lvl);
+        
+    }
+    
     function getAuthUser()
     {
         die('Get auth user is not implement.');
     }
+    
 }