Exemplo n.º 1
0
 function bVerifyUserAccessToReport($report, &$lNumFails, &$failTables)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glUserID, $gbAdmin;
     $lNumFails = 0;
     $failTables = array();
     if ($gbAdmin) {
         return true;
     }
     $lReportID = $report->lKeyID;
     // load search terms
     $this->loadSearchTermViaReportID($lReportID);
     // load sort terms
     $this->loadSortFieldsViaReportID($lReportID, $lNumSortTerms, $sortTerms);
     $this->uf = new muser_fields();
     // tables needed for the report
     crptTables\tablesUsed($report, $this->terms, $sortTerms, $tableIDs);
     if (count($tableIDs) == 0) {
         return true;
     }
     $cperm = new mpermissions();
     $cperm->loadUserAcctInfo($glUserID, $acctAccess);
     $cUF = new muser_fields();
     $cUF->lTableID = array();
     foreach ($tableIDs as $TID) {
         $cUF->lTableID[] = $TID;
     }
     $cUF->loadTableViaTableID(false);
     foreach ($cUF->userTables as $utable) {
         if (!$cperm->bDoesUserHaveAccess($acctAccess, $utable->lNumConsolidated, $utable->cperms)) {
             $failTables[$lNumFails] = '[' . $utable->enumTType . '] ' . $utable->strUserTableName;
             ++$lNumFails;
         }
     }
     return $lNumFails == 0;
 }
Exemplo n.º 2
0
 public function strExportUserTable($lTableID)
 {
     $cUF = new muser_fields();
     $cUF->lTableID = $lTableID;
     $cUF->loadTableViaTableID();
     $lNumFields = $cUF->lNumUF_TableFields($lTableID);
     if ($lNumFields == 0) {
         return '';
     }
     $cUF->loadTableFields();
     $enumTType = $cUF->userTables[0]->enumTType;
     $strTmpTable = 'tmpUFExport';
     $sqlStr = $this->strCreateTempTableUFExport($cUF->fields, $strTmpTable, $sqlDelete, $strFieldNamesSel);
     $this->db->query($sqlDelete);
     $this->db->query($sqlStr);
     //------------------------------------------------
     // populate the temp table with personalized data
     //------------------------------------------------
     $this->strPopulateUFTempData($cUF, $lTableID, $strTmpTable, $enumTType, $cUF->fields);
     //---------------------------
     // tie it all together
     //---------------------------
     $sqlStr = $this->strTmpTableJoinedToContext($enumTType, $strTmpTable, $strFieldNamesSel, 'tmp_lForeignID', true, '', '');
     $query = $this->db->query($sqlStr);
     return $this->dbutil->csv_from_result($query);
 }