Commit 1534b913 authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

feat() : change view resource button by download resource to prevent web...

feat() : change view resource button by download resource to prevent web browser visualisation of file
parent 101d4ebd
Pipeline #14652 failed with stages
in 1 minute and 3 seconds
...@@ -239,8 +239,6 @@ class archive ...@@ -239,8 +239,6 @@ class archive
if ($communicationDelay->invert != 0) { if ($communicationDelay->invert != 0) {
$archive->isCommunicable = '1'; $archive->isCommunicable = '1';
} }
} elseif (!$archive->hasRights) {
$archive->isCommunicable = '1';
} }
$archive->isInUserCollection = false; $archive->isInUserCollection = false;
...@@ -333,7 +331,7 @@ class archive ...@@ -333,7 +331,7 @@ class archive
\laabs::setResponseType($mimetype); \laabs::setResponseType($mimetype);
$response = \laabs::kernel()->response; $response = \laabs::kernel()->response;
$response->setHeader("Content-Disposition", "inline; filename=".$digitalResource->attachment->filename.""); $response->setHeader("Content-Disposition", "attachment; filename=".$digitalResource->attachment->filename."");
return $digitalResource->attachment->data; return $digitalResource->attachment->data;
} }
...@@ -1351,7 +1349,6 @@ class archive ...@@ -1351,7 +1349,6 @@ class archive
protected function readPrivilegesOnArchives() protected function readPrivilegesOnArchives()
{ {
$hasModificationPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modify"); $hasModificationPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modify");
$hasModificationOriginatorPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/adminOriginator");
$hasIntegrityCheckPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/checkIntegrity"); $hasIntegrityCheckPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/checkIntegrity");
$hasDestructionPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "destruction/destructionRequest"); $hasDestructionPrivilege = \laabs::callService('auth/userAccount/readHasprivilege', "destruction/destructionRequest");
$hasRestitutionPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "restitution/restitutionRequest"); $hasRestitutionPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "restitution/restitutionRequest");
...@@ -1360,7 +1357,6 @@ class archive ...@@ -1360,7 +1357,6 @@ class archive
$hasModificationRequestPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modificationRequestSend"); $hasModificationRequestPrivilege = $this->transaction && \laabs::callService('auth/userAccount/readHasprivilege', "archiveManagement/modificationRequestSend");
$this->view->setSource('hasModificationPrivilege', $hasModificationPrivilege); $this->view->setSource('hasModificationPrivilege', $hasModificationPrivilege);
$this->view->setSource('hasModificationOriginatorPrivilege', $hasModificationOriginatorPrivilege);
$this->view->setSource('hasIntegrityCheckPrivilege', $hasIntegrityCheckPrivilege); $this->view->setSource('hasIntegrityCheckPrivilege', $hasIntegrityCheckPrivilege);
$this->view->setSource('hasDestructionPrivilege', $hasDestructionPrivilege); $this->view->setSource('hasDestructionPrivilege', $hasDestructionPrivilege);
$this->view->setSource('hasRestitutionPrivilege', $hasRestitutionPrivilege); $this->view->setSource('hasRestitutionPrivilege', $hasRestitutionPrivilege);
...@@ -1432,30 +1428,4 @@ class archive ...@@ -1432,30 +1428,4 @@ class archive
return $file; return $file;
} }
/**
* Serializer JSON for changing originator method
* @param array $result
*
* @return object JSON object with a status and message parameters
*/
public function setOriginator($result)
{
$success = count($result['success']);
$echec = count($result['error']);
$this->json->message = '%1$s archive(s) modified.';
$this->json->message = $this->translator->getText($this->json->message);
$this->json->message = sprintf($this->json->message, $success);
if ($echec > 0) {
$message = '%1$s archive(s) can not be modified.';
$message = $this->translator->getText($message);
$message = sprintf($message, $echec);
$this->json->message .= ' '.$message;
}
return $this->json->save();
}
} }
...@@ -294,6 +294,9 @@ msgstr "Retour" ...@@ -294,6 +294,9 @@ msgstr "Retour"
msgid "View" msgid "View"
msgstr "Afficher" msgstr "Afficher"
msgid "Download"
msgstr "Télécharger"
msgid "Yes" msgid "Yes"
msgstr "Oui" msgstr "Oui"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<i class="infoIcon fa fa-file-o" /> <i class="infoIcon fa fa-file-o" />
</div> </div>
<div class="col-xs-12 text-center"> <div class="col-xs-12 text-center">
<button type="button" id="viewResource" class="btn btn-link btn-sm" data-resid="" data-archiveid=""><i class="fa-eye fa">&nbsp;</i>View</button> <button type="button" id="viewResource" class="btn btn-link btn-sm" data-resid="" data-archiveid=""><i class="fa-download fa">&nbsp;</i>Download</button>
<button type="button" id="deleteResource" class="btn btn-link btn-sm hide" data-resid="" data-archiveid="" title2="Delete"><i class="fa fa-trash">&nbsp;</i>Delete</button> <button type="button" id="deleteResource" class="btn btn-link btn-sm hide" data-resid="" data-archiveid="" title2="Delete"><i class="fa fa-trash">&nbsp;</i>Delete</button>
<button type="button" id="convertResource" class="btn btn-link btn-sm hide" data-resid="" data-archiveid=""><i class="fa fa-recycle">&nbsp;</i>Convert</button> <button type="button" id="convertResource" class="btn btn-link btn-sm hide" data-resid="" data-archiveid=""><i class="fa fa-recycle">&nbsp;</i>Convert</button>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment