inc/ACL.php
authorAlan Knowles <alan@akbkhome.com>
Thu, 27 Jan 2011 15:46:34 +0000 (23:46 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 27 Jan 2011 15:46:34 +0000 (23:46 +0800)
inc/ACL.php

index 5ec0f32..6bb09cc 100644 (file)
@@ -138,14 +138,14 @@ class MTrackACL
     $oidlist = join(',', $oidlist);
 
     $sql = <<<SQL
-select objectid as id, action, cascade, allow
+select objectid as id, action, cascader, allow
 from
   acl
 where
   role in ($role_list)
   and objectid in ($oidlist)
 order by
-  cascade desc,
+  cascader desc,
   seq asc
 SQL
     ;
@@ -163,7 +163,7 @@ SQL
       if (!isset($res_by_oid[$oid])) continue;
       foreach ($res_by_oid[$oid] as $row) {
 
-        if ($row['id'] == $objectid && $row['cascade']) {
+        if ($row['id'] == $objectid && $row['cascader']) {
           /* ignore items below the object of interest */
           continue;
         }
@@ -187,13 +187,13 @@ SQL
    * If entries is an empty array, or not an array, then the appropriate
    * ACL will be removed.
    */
-  static public function setACL($object, $cascade, $entries)
+  static public function setACL($object, $cascader, $entries)
   {
     self::$cache = array();
 
-    $cascade = (int)$cascade;
-    MTrackDB::q('delete from acl where objectid = ? and cascade = ?',
-      $object, $cascade);
+    $cascader = (int)$cascader;
+    MTrackDB::q('delete from acl where objectid = ? and cascader = ?',
+      $object, $cascader);
     $seq = 0;
     if (is_array($entries)) {
       foreach ($entries as $ent) {
@@ -204,22 +204,22 @@ SQL
         } else {
           list($role, $action, $allow) = $ent;
         }
-        MTrackDB::q('insert into acl (objectid, cascade, seq, role,
+        MTrackDB::q('insert into acl (objectid, cascader, seq, role,
               action, allow) values (?, ?, ?, ?, ?, ?)',
-            $object, $cascade, $seq++,
+            $object, $cascader, $seq++,
             $role, $action, (int)$allow);
       }
     }
   }
 
   /* Obtains the ACL entries for the specified object.
-   * If cascade is true, it will return the inheritable ACL.
+   * If cascader is true, it will return the inheritable ACL.
    */
-  static public function getACL($object, $cascade)
+  static public function getACL($object, $cascader)
   {
     return MTrackDB::q('select role, action, allow from acl
-      where objectid = ? and cascade = ? order by seq',
-      $object, (int)$cascade)->fetchAll(PDO::FETCH_ASSOC);
+      where objectid = ? and cascader = ? order by seq',
+      $object, (int)$cascader)->fetchAll(PDO::FETCH_ASSOC);
   }
 
   static public function hasAllRights($object, $rights)