コード例 #1
0
ファイル: acl.inc.php プロジェクト: BackupTheBerlios/sage
 function selectByPath($path)
 {
     $dbq = new DB();
     $dbq->db_connect();
     $query = "SELECT acl_id, user_id, sage_acl.path_id, delete_path, write_path, read_path,\n                  rename_path, delete_file, write_file, read_file, rename_file, sage_path.pathname\n                  FROM sage_acl, sage_path\n                  WHERE sage_acl.path_id = sage_path.path_id\r\n                  AND sage_path.pathname = '{$path}'";
     $acls = $dbq->db_select($query);
     for ($i = 0; $i < count($acls); $i++) {
         $acl = new ACL();
         $acl->initializeFromRow($acls[$i]);
         $this->list[] = $acl;
     }
     return true;
 }
コード例 #2
0
ファイル: user.inc.php プロジェクト: BackupTheBerlios/sage
 function getACLByPath($path)
 {
     $retacl = new ACL();
     if ($this->is_su == "1") {
         $retacl->acl_id = 1;
         $retacl->delete_path = "1";
         $retacl->write_path = "1";
         $retacl->read_path = "1";
         $retacl->rename_path = "1";
         $retacl->delete_file = "1";
         $retacl->write_file = "1";
         $retacl->read_file = "1";
         $retacl->rename_file = "1";
         return $retacl;
     }
     $done = false;
     $acllist = new ACLList();
     $curacls = array();
     $currentUserId = $this->user_id;
     while (!$done) {
         $currentUser = new User();
         if (!$currentUser->selectById($currentUserId)) {
             $done = true;
         } else {
             if ($acllist->selectByUserIdAndPath($currentUser->user_id, $path)) {
                 $curacls = $acllist->list;
             }
             if (count($curacls) == 0) {
                 $currentUserId = $currentUser->user_id_parent;
             } else {
                 $done = true;
                 $retacl->initializeFromRow($curacls[0]);
             }
         }
     }
     return $retacl;
 }