FOSSology  4.4.0
Open Source License Compliance by Open Source Software
AjaxExplorer.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008-2015 Hewlett-Packard Development Company, L.P.
4  SPDX-FileCopyrightText: © 2014-2017, 2020 Siemens AG
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 namespace Fossology\UI\Ajax;
10 
11 use ClearingView;
29 use Symfony\Component\HttpFoundation\JsonResponse;
30 use Symfony\Component\HttpFoundation\Request;
31 use Symfony\Component\HttpFoundation\Response;
32 
39 {
40  const NAME = "ajax_explorer";
41 
42  private $uploadtree_tablename = "";
44  private $uploadDao;
46  private $compatibilityDao;
48  private $licenseDao;
50  private $clearingDao;
52  private $agentDao;
54  private $clearingFilter;
56  private $licenseProjector;
58  private $filesThatShouldStillBeCleared;
60  private $filesToBeCleared;
68  protected $agentNames = AgentRef::AGENT_LIST;
72 
73  public function __construct()
74  {
75  parent::__construct(self::NAME, array(
76  self::TITLE => _("Ajax: License Browser"),
77  self::DEPENDENCIES => array("license"),
78  self::PERMISSION => Auth::PERM_READ,
79  self::REQUIRES_LOGIN => false
80  ));
81 
82  $this->uploadDao = $this->getObject('dao.upload');
83  $this->compatibilityDao = $this->getObject('dao.compatibility');
84  $this->licenseDao = $this->getObject('dao.license');
85  $this->clearingDao = $this->getObject('dao.clearing');
86  $this->agentDao = $this->getObject('dao.agent');
87  $this->clearingFilter = $this->getObject('businessrules.clearing_decision_filter');
88  $this->filesThatShouldStillBeCleared = [];
89  $this->filesToBeCleared = [];
90  $this->alreadyClearedUploadTreeView = NULL;
91  $this->noLicenseUploadTreeView = NULL;
92  $this->cacheClearedCounter = [];
93  }
94 
95  public function __destruct()
96  {
97  // Destruct the proxy views before exiting
98  if ($this->alreadyClearedUploadTreeView !== NULL) {
99  $this->alreadyClearedUploadTreeView->unmaterialize();
100  }
101  if ($this->noLicenseUploadTreeView !== NULL) {
102  $this->noLicenseUploadTreeView->unmaterialize();
103  }
104  }
105 
110  public function handle(Request $request)
111  {
112  $upload = intval($request->get("upload"));
113  $groupId = Auth::getGroupId();
114  if (!$this->uploadDao->isAccessible($upload, $groupId)) {
115  throw new \Exception("Permission Denied");
116  }
117 
118  $item = intval($request->get("item"));
119  $this->uploadtree_tablename = $this->uploadDao->getUploadtreeTableName($upload);
120  $itemTreeBounds = $this->uploadDao->getItemTreeBounds($item, $this->uploadtree_tablename);
121  $left = $itemTreeBounds->getLeft();
122  if (empty($left)) {
123  throw new \Exception("Job unpack/adj2nest hasn't completed.");
124  }
125 
126  $scannerAgents = array_keys($this->agentNames);
127  $scanJobProxy = new ScanJobProxy($this->agentDao, $upload);
128  $scanJobProxy->createAgentStatus($scannerAgents);
129  $selectedAgentId = intval($request->get('agentId'));
130  $tag_pk = intval($request->get('tag'));
131 
132  $UniqueTagArray = array();
133  $this->licenseProjector = new LicenseMap($this->getObject('db.manager'),$groupId,LicenseMap::CONCLUSION,true);
134  $vars = $this->createFileListing($tag_pk, $itemTreeBounds, $UniqueTagArray, $selectedAgentId, $groupId, $scanJobProxy, $request);
135 
136  return new JsonResponse(array(
137  'sEcho' => intval($request->get('sEcho')),
138  'aaData' => $vars['fileData'],
139  'iTotalRecords' => intval($request->get('totalRecords')),
140  'iTotalDisplayRecords' => $vars['iTotalDisplayRecords']
141  ) );
142  }
143 
144 
155  private function createFileListing($tagId, ItemTreeBounds $itemTreeBounds, &$UniqueTagArray, $selectedAgentId, $groupId, $scanJobProxy, $request)
156  {
157  if (!empty($selectedAgentId)) {
158  $agentName = $this->agentDao->getAgentName($selectedAgentId);
159  $selectedScanners = array($agentName=>$selectedAgentId);
160  } else {
161  $selectedScanners = $scanJobProxy->getLatestSuccessfulAgentIds();
162  }
163 
165  $uploadId = $itemTreeBounds->getUploadId();
166  $isFlat = $request->get('flatten') !== null;
167 
168  if ($isFlat) {
169  $options = array(UploadTreeProxy::OPT_RANGE => $itemTreeBounds);
170  } else {
171  $options = array(UploadTreeProxy::OPT_REALPARENT => $itemTreeBounds->getItemId());
172  }
173 
174  $searchMap = array();
175  foreach (explode(' ',$request->get('sSearch')) as $pair) {
176  $a = explode(':',$pair);
177  if (count($a) == 1) {
178  $searchMap['head'] = $pair;
179  } else {
180  $searchMap[$a[0]] = $a[1];
181  }
182  }
183 
184  if (array_key_exists('ext', $searchMap) && strlen($searchMap['ext'])>=1) {
185  $options[UploadTreeProxy::OPT_EXT] = $searchMap['ext'];
186  }
187  if (array_key_exists('head', $searchMap) && strlen($searchMap['head'])>=1) {
188  $options[UploadTreeProxy::OPT_HEAD] = $searchMap['head'];
189  }
190  if (($rfId=$request->get('scanFilter'))>0) {
191  $options[UploadTreeProxy::OPT_AGENT_SET] = $selectedScanners;
192  $options[UploadTreeProxy::OPT_SCAN_REF] = $rfId;
193  }
194  if (($rfId=$request->get('conFilter'))>0) {
195  $options[UploadTreeProxy::OPT_GROUP_ID] = Auth::getGroupId();
196  $options[UploadTreeProxy::OPT_CONCLUDE_REF] = $rfId;
197  }
198  $openFilter = $request->get('openCBoxFilter');
199  if ($openFilter=='true' || $openFilter=='checked') {
200  $options[UploadTreeProxy::OPT_AGENT_SET] = $selectedScanners;
201  $options[UploadTreeProxy::OPT_GROUP_ID] = Auth::getGroupId();
202  $options[UploadTreeProxy::OPT_SKIP_ALREADY_CLEARED] = true;
203  }
204 
205  $descendantView = new UploadTreeProxy($uploadId, $options, $itemTreeBounds->getUploadTreeTableName(), 'uberItems');
206 
207  $vars['iTotalDisplayRecords'] = $descendantView->count();
208 
209  $columnNamesInDatabase = array($isFlat?'ufile_name':'lft');
210  $defaultOrder = array(array(0, "asc"));
211 
212  $orderString = $this->getObject('utils.data_tables_utility')->getSortingString($request->get('fromRest') ? $request->request->all(): $request->query->all(), $columnNamesInDatabase, $defaultOrder);
213 
214  $offset = $request->get('iDisplayStart');
215  $limit = $request->get('iDisplayLength');
216  if ($offset) {
217  $orderString .= " OFFSET $offset";
218  }
219  if ($limit) {
220  $orderString .= " LIMIT $limit";
221  }
222 
223  /* Get ALL the items under this Uploadtree_pk */
224  $sql = $descendantView->getDbViewQuery()." $orderString";
225  $dbManager = $this->getObject('db.manager');
226 
227  $dbManager->prepare($stmt=__METHOD__.$orderString,$sql);
228  $res = $dbManager->execute($stmt,$descendantView->getParams());
229  $descendants = $dbManager->fetchAll($res);
230  $dbManager->freeResult($res);
231 
232  /* Filter out Children that don't have tag */
233  if (!empty($tagId)) {
234  TagFilter($descendants, $tagId, $itemTreeBounds->getUploadTreeTableName());
235  }
236  if (empty($descendants)) {
237  $vars['fileData'] = array();
238  return $vars;
239  }
240 
241  if ($isFlat) {
242  $firstChild = reset($descendants);
243  $lastChild = end($descendants);
244  $nameRange = array($firstChild['ufile_name'],$lastChild['ufile_name']);
245  } else {
246  $nameRange = array();
247  }
248 
249  $allDecisions = $this->clearingDao->getFileClearingsFolder($itemTreeBounds, $groupId, $isFlat);
250  $editedMappedLicenses = $this->clearingFilter->filterCurrentClearingDecisions($allDecisions);
251 
252  $pfileLicenses = $this->updateTheFindingsAndDecisions($selectedScanners,
253  $isFlat, $groupId, $editedMappedLicenses, $itemTreeBounds, $nameRange);
254 
255  $baseUri = Traceback_uri().'?mod=license'.Traceback_parm_keep(array('upload','folder','show'));
256 
257  $tableData = array();
258  global $Plugins;
259  $ModLicView = &$Plugins[plugin_find_id("view-license")];
260  $latestSuccessfulAgentIds = $scanJobProxy->getLatestSuccessfulAgentIds();
261  foreach ($descendants as $child) {
262  if (empty($child)) {
263  continue;
264  }
265  $tableData[] = $this->createFileDataRow($child, $uploadId, $selectedAgentId, $pfileLicenses, $groupId, $editedMappedLicenses, $baseUri, $ModLicView, $UniqueTagArray, $isFlat, $latestSuccessfulAgentIds, $request);
266  }
267 
268  $vars['fileData'] = $tableData;
269  return $vars;
270  }
271 
272 
288  private function createFileDataRow($child, $uploadId, $selectedAgentId, $pfileLicenses, $groupId, $editedMappedLicenses, $uri, $ModLicView, &$UniqueTagArray, $isFlat, $latestSuccessfulAgentIds, $request)
289  {
290  $fileDetails = array(
291  "fileName" => "", "id" => "", "uploadId" => $uploadId, "agentId" => "", "isContainer" => false,
292  );
293 
294  $fileId = $child['pfile_fk'];
295  $childUploadTreeId = $child['uploadtree_pk'];
296  $linkUri = '';
297  if (!empty($fileId) && !empty($ModLicView)) {
298  $linkUri = Traceback_uri();
299  $linkUri .= "?mod=view-license&upload=$uploadId&item=$childUploadTreeId";
300  $fileDetails["id"] = intval($childUploadTreeId);
301  $fileDetails["uploadId"] = $uploadId;
302  if ($selectedAgentId) {
303  $linkUri .= "&agentId=$selectedAgentId";
304  $fileDetails["agentId"] = $selectedAgentId;
305  }
306  }
307 
308  /* Determine link for containers */
309  $isContainer = Iscontainer($child['ufile_mode']);
310  if ($isContainer && !$isFlat) {
311  $fatChild = $this->uploadDao->getFatItemArray($child['uploadtree_pk'], $uploadId, $this->uploadtree_tablename);
312  $uploadtree_pk = $fatChild['item_id'];
313  $childUploadTreeId = $uploadtree_pk;
314  $upload = $this->uploadDao->getUploadEntry($uploadtree_pk, $this->uploadtree_tablename);
315  $fileId = $upload['pfile_fk'];
316  $parent = $upload['realparent'];
317  $parentItemTreeBound = $this->uploadDao->getItemTreeBounds($parent, $this->uploadtree_tablename);
318 
319  $pfileLicenses = array_replace($pfileLicenses,
320  $this->updateTheFindingsAndDecisions($latestSuccessfulAgentIds, $isFlat,
321  $groupId, $editedMappedLicenses, $parentItemTreeBound));
322 
323  $linkUri = "$uri&item=" . $uploadtree_pk;
324  $fileDetails["id"] = intval($uploadtree_pk);
325  if ($selectedAgentId) {
326  $linkUri .= "&agentId=$selectedAgentId";
327  $fileDetails["agentId"] = $selectedAgentId;
328  }
329  $child['ufile_name'] = $fatChild['ufile_name'];
330  if (!Iscontainer($fatChild['ufile_mode'])) {
331  $isContainer = false;
332  }
333  } else if ($isContainer) {
334  $uploadtree_pk = Isartifact($child['ufile_mode']) ? DirGetNonArtifact($childUploadTreeId, $this->uploadtree_tablename) : $childUploadTreeId;
335  $linkUri = "$uri&item=" . $uploadtree_pk;
336  $fileDetails["id"] = intval($uploadtree_pk);
337  $fileDetails["isContainer"] = true;
338  if ($selectedAgentId) {
339  $linkUri .= "&agentId=$selectedAgentId";
340  $fileDetails["agentId"] = $selectedAgentId;
341  }
342  }
343 
344  /* Populate the output ($VF) - file list */
345  /* id of each element is its uploadtree_pk */
346  $fileName = $child['ufile_name'];
347  if ($isContainer) {
348  $fileDetails["fileName"] = $fileName;
349  $fileName = "<a href='$linkUri'><span style='color: darkblue'> <b>$fileName</b> </span></a>";
350  } else if (!empty($linkUri)) {
351  $fileDetails["fileName"] = $fileName;
352  $fileName = "<a href='$linkUri'>$fileName</a>";
353  }
354  /* show licenses under file name */
355  $childItemTreeBounds =
356  new ItemTreeBounds($childUploadTreeId, $this->uploadtree_tablename, $child['upload_fk'], $child['lft'], $child['rgt']);
357  $totalFilesCount = $this->uploadDao->countPlainFiles($childItemTreeBounds);
358  $licenseEntriesRest = array();
359  if ($isContainer) {
360  $fileDetails["isContainer"] = true;
361  $agentFilter = $selectedAgentId ? array($selectedAgentId) : $latestSuccessfulAgentIds;
362  $licenseEntries = $this->licenseDao->getLicenseShortnamesContained($childItemTreeBounds, $agentFilter, array());
363  $editedLicenses = $this->clearingDao->getClearedLicenses($childItemTreeBounds, $groupId);
364 
365  if ($request->get('fromRest')) {
366  foreach ($licenseEntries as $shortName) {
367  $lookedupLicense = $this->licenseDao->getLicenseByShortName($shortName, $groupId);
368  if ($lookedupLicense !== null) {
369  $licenseEntriesRest[] = array(
370  "id" => $lookedupLicense->getId(),
371  "name" => $shortName,
372  "agents" => []
373  );
374  }
375  }
376  }
377  } else {
378  $licenseEntries = array();
379  if (array_key_exists($fileId, $pfileLicenses)) {
380  foreach ($pfileLicenses[$fileId] as $shortName => $rfInfo) {
381  $agentEntries = array();
382  $agentEntriesRest = array();
383  foreach ($rfInfo as $agent => $match) {
384  $agentName = $this->agentNames[$agent];
385  $agentEntry = "<a href='?mod=view-license&upload=$child[upload_fk]&item=$childUploadTreeId&format=text&agentId=$match[agent_id]&licenseId=$match[license_id]#highlight'>" . $agentName . "</a>";
386 
387  if ($match['match_percentage'] > 0) {
388  $agentEntry .= ": $match[match_percentage]%";
389  }
390  $agentEntries[] = $agentEntry;
391  $agentEntriesRest[] = array(
392  "name" => $agentName,
393  "id" => intval($match['agent_id']),
394  "matchPercentage" => intval($match['match_percentage']),
395  );
396  }
397 
398  $lookedupLicense = $this->licenseDao->getLicenseByShortName($shortName, $groupId);
399  if ($lookedupLicense !== null) {
400  $licenseEntriesRest[] = array(
401  "id" => $lookedupLicense->getId(),
402  "name" => $shortName,
403  "agents" => $agentEntriesRest,
404  );
405  }
406 
407  //call that function----file_id,upload_id,shortname
408  try {
409  $compatible = $this->compatibilityDao->getCompatibilityForFile($childItemTreeBounds, $shortName);
410  } catch (InvalidAgentStageException) {
411  $compatible = true;
412  }
413  $licenseHtml = "";
414  if (!$compatible) {
415  $licenseHtml = "<span class='text-danger font-weight-bold'>$shortName</span>";
416  } else {
417  $licenseHtml = $shortName;
418  }
419  $licenseEntries[] = "$licenseHtml [" . implode("][", $agentEntries) . "]";
420  }
421  }
422 
423  /* @var $decision ClearingDecision */
424  if (false !== ($decision = $this->clearingFilter->getDecisionOf($editedMappedLicenses,$childUploadTreeId, $fileId))) {
425  $editedLicenses = $decision->getPositiveLicenses();
426  } else {
427  $editedLicenses = array();
428  }
429  }
430  $concludedLicensesRest = array();
431  $concludedLicenses = array();
433  foreach ($editedLicenses as $licenseRef) {
434  $projectedId = $this->licenseProjector->getProjectedId($licenseRef->getId());
435  $projectedName = $this->licenseProjector->getProjectedShortname($licenseRef->getId(),$licenseRef->getShortName());
436  $concludedLicenses[$projectedId] = $projectedName;
437  $concludedLicensesRest[] = array('id' => $projectedId, 'name' => $projectedName);
438  }
439 
440  $editedLicenseList = implode(', ', $concludedLicenses);
441  $licenseList = implode(', ', $licenseEntries);
442 
443  $fileListLinks = FileListLinks($uploadId, $childUploadTreeId, 0, $fileId, true, $UniqueTagArray, $this->uploadtree_tablename, !$isFlat);
444 
445  $getTextEditUser = _("Edit");
446  $fileListLinks .= "[<a href='#' onclick='openUserModal($childUploadTreeId)' >$getTextEditUser</a>]";
447 
448  if ($isContainer) {
449  $getTextEditBulk = _("Bulk");
450  $fileListLinks .= "[<a href='#' data-toggle='modal' data-target='#bulkModal' onclick='openBulkModal($childUploadTreeId)' >$getTextEditBulk</a>]";
451  }
452  $fileListLinks .= "<input type='checkbox' class='selectedForIrrelevant' class='info-bullet view-license-rc-size' value='".$childUploadTreeId."'>";
453  $filesThatShouldStillBeCleared = array_key_exists($childItemTreeBounds->getItemId()
454  , $this->filesThatShouldStillBeCleared) ? $this->filesThatShouldStillBeCleared[$childItemTreeBounds->getItemId()] : 0;
455 
456  $filesToBeCleared = array_key_exists($childItemTreeBounds->getItemId()
457  , $this->filesToBeCleared) ? $this->filesToBeCleared[$childItemTreeBounds->getItemId()] : 0;
458 
459  $filesCleared = $filesToBeCleared - $filesThatShouldStillBeCleared;
460 
461  $img = ($filesCleared == $filesToBeCleared) ? 'green' : 'red';
462 
463  // override green/red flag with grey flag in case of no_license_found scanner finding
464  if (!empty($licenseList) && empty($editedLicenseList)) {
465  $img = (
466  (strpos($licenseList, LicenseDao::NO_LICENSE_FOUND) !== false)
467  &&
468  (count(explode(",", $licenseList)) == 1)
469  ) ? 'grey' : $img;
470  }
471 
472  // override green/red flag with yellow flag in case of single file with decision type "To Be Discussed"
473  $isDecisionTBD = $this->clearingDao->isDecisionCheck($childUploadTreeId, $groupId, DecisionTypes::TO_BE_DISCUSSED);
474  $img = $isDecisionTBD ? 'yellow' : $img;
475 
476  // override green/red flag with greenRed flag in case of single file with decision type "Do Not Use" or "Non functional"
477  $isDecisionDNU = $this->clearingDao->isDecisionCheck($childUploadTreeId, $groupId, DecisionTypes::DO_NOT_USE);
478  $isDecisionNonFunctional = $this->clearingDao->isDecisionCheck($childUploadTreeId, $groupId, DecisionTypes::NON_FUNCTIONAL);
479 
480  $img = ($isDecisionDNU || $isDecisionNonFunctional) ? 'redGreen' : $img;
481 
482  return $request->get('fromRest') ? array(
483  "fileDetails" => $fileDetails,
484  "licenseList" => $licenseEntriesRest,
485  "editedLicenseList" => $concludedLicensesRest,
486  "clearingStatus" => $img,
487  "clearingProgress" => array(
488  "filesCleared" => intval($filesCleared),
489  "filesToBeCleared" => intval($filesToBeCleared),
490  "totalFilesCount" => intval($totalFilesCount)
491  ),
492  ) : array($fileName, $licenseList, $editedLicenseList, $img, "$filesCleared / $filesToBeCleared / $totalFilesCount", $fileListLinks);
493  }
494 
507  private function updateTheFindingsAndDecisions($agentIds, $isFlat, $groupId,
508  &$editedMappedLicenses, $itemTreeBounds, $nameRange = array())
509  {
513  $pfileLicenses = [];
514  foreach ($agentIds as $agentName => $agentId) {
515  $licensePerPfile = $this->licenseDao->getLicenseIdPerPfileForAgentId(
516  $itemTreeBounds, $agentId, $isFlat, $nameRange);
517  foreach ($licensePerPfile as $pfile => $licenseRow) {
518  foreach ($licenseRow as $licId => $row) {
519  $lic = $this->licenseProjector->getProjectedShortname($licId);
520  $pfileLicenses[$pfile][$lic][$agentName] = $row;
521  }
522  }
523  }
524 
525  if ($this->alreadyClearedUploadTreeView === NULL) {
526  // Initialize the proxy view only once for the complete table
527  $this->alreadyClearedUploadTreeView = new UploadTreeProxy(
528  $itemTreeBounds->getUploadId(),
529  $options = array(
530  UploadTreeProxy::OPT_SKIP_THESE => UploadTreeProxy::OPT_SKIP_ALREADY_CLEARED,
531  UploadTreeProxy::OPT_ITEM_FILTER => "AND (lft BETWEEN " .
532  $itemTreeBounds->getLeft() . " AND " . $itemTreeBounds->getRight() . ")",
533  UploadTreeProxy::OPT_GROUP_ID => $groupId
534  ), $itemTreeBounds->getUploadTreeTableName(),
535  $viewName = 'already_cleared_uploadtree' . $itemTreeBounds->getUploadId());
536 
537  $this->alreadyClearedUploadTreeView->materialize();
538  }
539 
540  if ($this->noLicenseUploadTreeView === NULL) {
541  // Initialize the proxy view only once for the complete table
542  $this->noLicenseUploadTreeView = new UploadTreeProxy(
543  $itemTreeBounds->getUploadId(),
544  $options = array(
545  UploadTreeProxy::OPT_SKIP_THESE => "noLicense",
546  UploadTreeProxy::OPT_ITEM_FILTER => "AND (lft BETWEEN " .
547  $itemTreeBounds->getLeft() . " AND " . $itemTreeBounds->getRight() . ")",
548  UploadTreeProxy::OPT_GROUP_ID => $groupId
549  ), $itemTreeBounds->getUploadTreeTableName(),
550  $viewName = 'no_license_uploadtree' . $itemTreeBounds->getUploadId());
551  $this->noLicenseUploadTreeView->materialize();
552  }
553 
554  $this->updateFilesToBeCleared($isFlat, $itemTreeBounds);
555  $allDecisions = $this->clearingDao->getFileClearingsFolder($itemTreeBounds,
556  $groupId, $isFlat);
557  $editedMappedLicenses = array_replace($editedMappedLicenses,
558  $this->clearingFilter->filterCurrentClearingDecisions($allDecisions));
559  return $pfileLicenses;
560  }
561 
568  private function updateFilesToBeCleared($isFlat, $itemTreeBounds)
569  {
570  $itemId = $itemTreeBounds->getItemId();
571  if (in_array($itemId, $this->cacheClearedCounter)) {
572  // Already calculated, no need to recount
573  return;
574  }
575  $this->cacheClearedCounter[] = $itemId;
576  if (! $isFlat) {
577  $this->filesThatShouldStillBeCleared = array_replace(
578  $this->filesThatShouldStillBeCleared,
579  $this->alreadyClearedUploadTreeView->countMaskedNonArtifactChildren(
580  $itemId));
581  $this->filesToBeCleared = array_replace($this->filesToBeCleared,
582  $this->noLicenseUploadTreeView->countMaskedNonArtifactChildren(
583  $itemId));
584  } else {
585  $this->filesThatShouldStillBeCleared = array_replace(
586  $this->filesThatShouldStillBeCleared,
587  $this->alreadyClearedUploadTreeView->getNonArtifactDescendants(
588  $itemTreeBounds));
589  $this->filesToBeCleared = array_replace($this->filesToBeCleared,
590  $this->noLicenseUploadTreeView->getNonArtifactDescendants($itemTreeBounds));
591  }
592  }
593 }
594 
595 register_plugin(new AjaxExplorer());
char * uploadtree_tablename
upload.uploadtree_tablename
Definition: adj2nest.c:100
Contains the constants and helpers for authentication of user.
Definition: Auth.php:24
static getGroupId()
Get the current user's group id.
Definition: Auth.php:80
Various utility functions to filter ClearingDecision.
Wrapper class for license map.
Definition: LicenseMap.php:19
updateTheFindingsAndDecisions($agentIds, $isFlat, $groupId, &$editedMappedLicenses, $itemTreeBounds, $nameRange=array())
Fetch the license findings and decisions.
updateFilesToBeCleared($isFlat, $itemTreeBounds)
createFileListing($tagId, ItemTreeBounds $itemTreeBounds, &$UniqueTagArray, $selectedAgentId, $groupId, $scanJobProxy, $request)
Isartifact($mode)
Definition: common-dir.php:29
DirGetNonArtifact($UploadtreePk, $uploadtree_tablename='uploadtree')
Given an artifact directory (uploadtree_pk), return the first non-artifact directory (uploadtree_pk).
Definition: common-dir.php:158
Iscontainer($mode)
Definition: common-dir.php:38
FileListLinks($upload_fk, $uploadtree_pk, $napk, $pfile_pk, $Recurse=True, &$UniqueTagArray=array(), $uploadtree_tablename="uploadtree", $wantTags=true)
Get list of links: [View][Info][Download]
Traceback_uri()
Get the URI without query to this location.
Definition: common-parm.php:97
Traceback_parm_keep($List)
Create a new URI, keeping only these items.
TagFilter(&$UploadtreeRows, $tag_pk, $uploadtree_tablename)
Given a list of uploadtree recs, remove recs that do not have $tag_pk.