Пример #1
0
 private function unsetRightByPath($group_id, $path)
 {
     $filesRightsId = array();
     $tableFilesRights = new USVN_Db_Table_FilesRights();
     $whereFilesRights = $tableFilesRights->getAdapter()->quoteInto("files_rights_path LIKE ? ", $path);
     $whereFilesRights .= $tableFilesRights->getAdapter()->quoteInto(" AND projects_id = ? ", $this->_project);
     foreach ($tableFilesRights->fetchAll($whereFilesRights) as $filesRights) {
         $filesRightsId[] = $filesRights->id;
     }
     if (count($filesRightsId) > 0) {
         $table = new USVN_Db_Table_GroupsToFilesRights();
         $where = $table->getAdapter()->quoteInto("files_rights_id IN (?) ", $filesRightsId);
         $where .= $table->getAdapter()->quoteInto("and groups_id = ? ", $group_id);
         $table->delete($where);
         $where = $table->getAdapter()->quoteInto("files_rights_id IN (?) ", $filesRightsId);
         if (count($table->fetchAll($where)) == 0) {
             $tableFilesRights->delete($whereFilesRights);
         }
     }
 }