DataObjects/Core_watch.php
[Pman.Core] / DataObjects / Group_rights.php
index be1d9ac..b3877d3 100755 (executable)
@@ -34,6 +34,19 @@ class Pman_Core_DataObjects_Group_rights extends DB_DataObject
     
     var $fullRights = "ADESPIM";
     
+    
+    function groupsWithRights($rightname, $right)
+    {
+        $t = clone($this);
+        $t->rightname = $rightname;
+        $t->whereAdd("accessmask like '{$this->escape($right)}'");
+        $t->selectAdd();
+        $t->selectAdd('distinct(group_id) as group_id');
+        return $t->fetchAll('group_id');
+         
+    }
+    
+    
     function listPermsFromGroupIds($grps, $isAdmin=false, $isOwner = false) {
         
         $t = clone($this);
@@ -72,10 +85,10 @@ class Pman_Core_DataObjects_Group_rights extends DB_DataObject
             
             if (isset($ret[$k])) {
                 if (empty($ret[$k]) && $isAdmin) {
-                    $r[$k] = $isOwner ? $v[0] : '' ; // if it's public, the get no default rights
+                    $r[$k] = $v[0] ; // -- it's admin they get rights... can not be disabled..
                     continue;
                 }
-                
+                // in theory non-owners could sneak in rights here..??
                 $r[$k] = $ret[$k];
                 continue;
             }