GroupRights.php
[Pman.Admin] / GroupRights.php
index ebedf80..d92a547 100644 (file)
@@ -28,7 +28,7 @@ class Pman_Admin_GroupRights extends Pman
     
     // FOR PERMS - SEE THE DATAOBJECT!
     
-    function get()
+    function get($v, $opts = Array())
     {
         // must recieve a group..
         if (!isset($_GET['group_id']) || (int)$_GET['group_id'] < 0) {
@@ -38,13 +38,13 @@ class Pman_Admin_GroupRights extends Pman
             $this->jerr("PERMISSION DENIED");
         }
         
-        $g = DB_DataObject::Factory('groups');
+        $g = DB_DataObject::Factory('core_group');
         if (!$g->get($_GET['group_id'])) {
             $this->jerr("group is invalid");
         }
         //print_r($g);
          //   DB_DataObject::debugLevel(1);
-        $p = DB_DataObject::factory('group_rights');
+        $p = DB_DataObject::factory('core_group_right');
         $p->group_id = (int)$_GET['group_id'];
         $p->find();
         $cur = array();
@@ -52,6 +52,9 @@ class Pman_Admin_GroupRights extends Pman
         while ($p->fetch()) {
             $cur[$p->rightname] = clone($p);
         }
+        
+//        print_r($cur);exit;
+        
         $e = -1;
         $ar = array();
         // echo "<PRE>"; print_r($p->defaultPermData() );
@@ -63,7 +66,7 @@ class Pman_Admin_GroupRights extends Pman
             if (!isset($cur[$k])) {
                 // then there is no current access right for it..
                 //DB_DataObject::debugLevel(1);
-                $gr = DB_DataObject::factory('group_rights');
+                $gr = DB_DataObject::factory('core_group_right');
                 $gr->group_id = (int)$_GET['group_id'];
                 $gr->rightname = $k;
                 $gr->accessmask = $g->type == 2 ? '' : $defdata[1]; // set to defaults.. unless it's a contact group.
@@ -89,12 +92,13 @@ class Pman_Admin_GroupRights extends Pman
     
     
     // post.. 
-    function post()
+    function post($v)
     {
         if (!isset($_POST['group_id']) || (int)$_POST['group_id'] < 0) {
             $this->jerr("NO GROUP");
         }
-        if (!$this->hasPerm( 'Core.Groups','E')) { // editing groups..
+        
+        if (!$this->checkPerm('Core.Groups','E')) { // editing groups..
             $this->jerr("PERMISSION DENIED");
         }
         
@@ -106,7 +110,7 @@ class Pman_Admin_GroupRights extends Pman
         if (!empty($_POST['dataUpdate'])) {
             foreach($_POST['dataUpdate'] as $id => $ac) {
                 $id  = (int)$id;
-                $p = DB_DataObject::factory('group_rights');
+                $p = DB_DataObject::factory('core_group_right');
                 $p->group_id = (int)$_POST['group_id'];
                 if (!$p->get($id)) {
                     $this->jerr("could not find gid:{$p->group_id} and $id");
@@ -120,7 +124,7 @@ class Pman_Admin_GroupRights extends Pman
         }
         if (!empty($_POST['dataAdd'])) {
             foreach($_POST['dataAdd'] as $perm => $ac) {
-                $p = DB_DataObject::factory('group_rights');
+                $p = DB_DataObject::factory('core_group_right');
                 $p->group_id = (int)$_POST['group_id'];
                 $p->rightname = $perm;
                 $p->accessmask = $ac;
@@ -133,9 +137,10 @@ class Pman_Admin_GroupRights extends Pman
         
         
     }
-     
-    
-    
     
+    function checkPerm($lvl, $au)
+    {
+        return $au->hasPerm("Core.Groups", $lvl);
+    }
     
 }
\ No newline at end of file