13 namespace Fossology\UI\Api\Models;
18 use Symfony\Component\HttpFoundation\Request;
20 if (!class_exists(
"AgentAdder",
false)) {
21 require_once dirname(__DIR__, 2) .
"/agent-add.php";
23 require_once dirname(__DIR__, 4) .
"/lib/php/common-folders.php";
97 foreach ($uploadsAccessible as $singleUpload) {
98 if ($singleUpload[
'upload_pk'] == $uploadId) {
103 if ($found ===
false) {
105 "Folder id $folderId does not have upload id " .
106 "$uploadId or you do not have write access to the folder.");
110 $paramAgentRequest =
new Request();
115 $returnStatus = (new \AgentAdder())->
scheduleAgents($uploadId, $agentsToAdd, $paramAgentRequest);
116 if (is_numeric($returnStatus)) {
117 return new Info(201, $returnStatus, InfoType::INFO);
131 foreach ($this->analysis->getArray() as $agent => $set) {
133 if ($agent ==
"copyright_email_author") {
134 $agentsToAdd[] =
"agent_copyright";
135 $request->request->set(
"Check_agent_copyright", 1);
136 } elseif ($agent ==
"patent") {
137 $agentsToAdd[] =
"agent_ipra";
138 $request->request->set(
"Check_agent_ipra", 1);
139 } elseif ($agent ==
"package") {
140 $agentsToAdd[] =
"agent_pkgagent";
141 $request->request->set(
"Check_agent_pkgagent", 1);
143 $agentsToAdd[] =
"agent_$agent";
144 $request->request->set(
"Check_agent_$agent", 1);
157 if ($this->reuse->getReuseUpload() == 0) {
162 if ($this->reuse->getReuseMain() ===
true) {
163 $reuserRules[] =
'reuseMain';
165 if ($this->reuse->getReuseEnhanced() ===
true) {
166 $reuserRules[] =
'reuseEnhanced';
168 if ($this->reuse->getReuseReport() ===
true) {
169 $reuserRules[] =
'reuseConf';
171 if ($this->reuse->getReuseCopyright() ===
true) {
172 $reuserRules[] =
'reuseCopyright';
174 $userDao = $GLOBALS[
'container']->get(
"dao.user");
175 $reuserSelector = $this->reuse->getReuseUpload() .
"," . $userDao->getGroupIdByName($this->reuse->getReuseGroup());
176 $request->request->set(
'uploadToReuse', $reuserSelector);
177 $request->request->set(
'reuseMode', $reuserRules);
187 if ($this->decider->getNomosMonk() ===
true) {
188 $deciderRules[] =
'nomosInMonk';
190 if ($this->decider->getBulkReused() ===
true) {
191 $deciderRules[] =
'reuseBulk';
193 if ($this->decider->getNewScanner() ===
true) {
194 $deciderRules[] =
'wipScannerUpdates';
196 if ($this->decider->getOjoDecider() ===
true) {
197 $deciderRules[] =
'ojoNoContradiction';
199 if (! empty($this->decider->getConcludeLicenseType())) {
200 $deciderRules[] =
'licenseTypeConc';
201 $request->request->set(
'licenseTypeConc',
202 $this->decider->getConcludeLicenseType());
204 $request->request->set(
'deciderRules', $deciderRules);
205 if ($this->analysis->getNomos()) {
206 $request->request->set(
'Check_agent_nomos', 1);
217 if ($this->scancode->getScanLicense() ===
true) {
218 $scancodeRules[] =
'license';
220 if ($this->scancode->getScanCopyright() ===
true) {
221 $scancodeRules[] =
'copyright';
223 if ($this->scancode->getScanEmail() ===
true) {
224 $scancodeRules[] =
'email';
226 if ($this->scancode->getScanUrl() ===
true) {
227 $scancodeRules[] =
'url';
229 $request->request->set(
'scancodeFlags', $scancodeRules);
Contains the constants and helpers for authentication of user.
Info model to contain general error and return values.
Model to hold add settings for new scan.
prepareScancode(Request &$request)
scheduleAgents($folderId, $uploadId, $newUpload=true)
prepareReuser(Request &$request)
prepareAgents(Request &$request)
__construct($analysis, $reuse, $decider, $scancode)
prepareDecider(Request &$request)
FolderListUploads_perm($ParentFolder, $perm)
Returns an array of uploads in a folder.