Commit 4e517f41 authored by Alexandre Morin's avatar Alexandre Morin

Merge branch 'hotfix/2.1.3' into 'master'

Hotfix/2.1.3

See merge request !60
parents fbd2799e ebf3c349
Description
===========
MaarchRM is a open source software that allows you to store, find and display
MaarchRM is an open source software that allows you to store, find and display
your digital resources in compliance with international regulation ISO. It’s a
full featured PHP PostgresSQL software.
......
......@@ -136,6 +136,45 @@ publicUserStory = "['app/*']"
; 'adminFunc/contact'
;]"
servicePrivileges = "[
{
'serviceURI': 'audit/event/createChainjournal',
'description' : 'Chaîner le journal de l\'application'
},
{
'serviceURI': 'batchProcessing/scheduling/updateProcess',
'description' : 'Exécution automatique des tâches planifiées'
},
{
'serviceURI': 'lifeCycle/journal/createChainjournal',
'description' : 'Chaîner le journal du cycle de vie'
},
{
'serviceURI': 'recordsmanagement/archivecompliance/readperiodic',
'description' : 'Valider l\'intégrité des archives'
},
{
'serviceURI': 'recordsManagement/archives/deleteDisposablearchives',
'description' : 'Détruire les archives'
},
{
'serviceURI': 'recordsManagement/archives/updateIndexfulltext',
'description' : 'Extraction plein texte'
},
{
'serviceURI': 'recordsManagement/archive/create',
'description' : 'Création d\'une archive'
},
{
'serviceURI': 'recordsManagement/archive/createArchiveBatch',
'description' : 'Création par batch d\'archive(s)'
},
{
'serviceURI': '*',
'description' : 'Tous les droits'
}
]"
[lifeCycle]
; Chain life cycle journal by originator in addition to the main journal
......
INSERT INTO "lifeCycle"."eventFormat" ("type", "format", "notification", "message") VALUES
('recordsManagement/outgoingTransfer', 'resId hashAlgorithm hash address originatorOrgRegNumber archiverOrgRegNumber size', FALSE, 'Transfert sortant de l''archive %6$s');
\ No newline at end of file
......@@ -77,8 +77,19 @@ class serviceAccount
public function newService()
{
$account = \laabs::newInstance('auth/account');
$account->accountType = 'service';
$servicePrivilegesTmp= \laabs::configuration('auth')['servicePrivileges'];
foreach ($servicePrivilegesTmp as $value) {
$servicePrivilege = \laabs::newInstance('auth/servicePrivilege');
$servicePrivilege->serviceURI = $value['serviceURI'];
$servicePrivilege->description = $value['description'];
$serviceAccount->servicePrivilegeOptions [] = $servicePrivilege;
}
$serviceAccount->servicePrivilege = null;
return $serviceAccount;
}
/**
......@@ -161,6 +172,15 @@ class serviceAccount
{
$serviceAccount = $this->sdoFactory->read('auth/account', $serviceAccountId);
$servicePosition = \laabs::callService("organization/servicePosition/read_serviceAccountId_", $serviceAccountId);
$servicePrivilegesTmp= \laabs::configuration('auth')['servicePrivileges'];
foreach ($servicePrivilegesTmp as $value){
$servicePrivilege = \laabs::newInstance('auth/servicePrivilege');
$servicePrivilege->serviceURI = $value['serviceURI'];
$servicePrivilege->description = $value['description'];
$serviceAccount->servicePrivilegeOptions [] = $servicePrivilege;
}
if (isset($servicePosition->organization)) {
$serviceAccount->orgId = $servicePosition->organization->orgId;
......
......@@ -35,6 +35,7 @@ class archive
archiveComplianceTrait,
archiveConversionTrait,
archiveDestructionTrait,
archiveOutgoingTransferTrait,
archiveLifeCycleTrait;
/**
......
......@@ -129,9 +129,9 @@ trait archiveComplianceTrait
$this->lifeCycleJournalController->logEvent('recordsManagement/periodicIntegrityCheck', 'recordsManagement/serviceLevel', $serviceLevel->serviceLevelId, $eventInfo, $success);
$totalNbArchivesToCheck += nbArchivesToCheck;
$totalNbArchivesInSample += nbArchivesInSample;
$totalarchivesChecked += archivesChecked;
$totalNbArchivesToCheck += $nbArchivesToCheck;
$totalNbArchivesInSample += $nbArchivesInSample;
$totalarchivesChecked += $archivesChecked;
}
$logMessage = ["message" => "%s archive(s) to check", "variables"=> $totalNbArchivesToCheck];
......
......@@ -216,6 +216,18 @@ trait archiveLifeCycleTrait
}
/**
* Log an archive outgoing transfer
* @param recordsManagement/archive $archive The archive
* @param bool $operationResult The operation result
*
* @return mixed The created event or the list of created event
*/
public function logOutgoingTransfer($archive, $operationResult = true)
{
return $this->logLifeCycleEvent('recordsManagement/outgoingTransfer', $archive, $operationResult);
}
/**
* Log an archive retention rule modification
* @param recordsManagement/archive $archive The archive
* @param object $retentionRule The retention rule object
......
<?php
/*
* Copyright (C) 2015 Maarch
*
* This file is part of bundle recordsManagement.
*
* Bundle recordsManagement is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle recordsManagement is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle recordsManagement. If not, see <http://www.gnu.org/licenses/>.
*/
namespace bundle\recordsManagement\Controller;
/**
* Trait for archives restitution
*/
trait archiveOutgoingTransferTrait
{
/**
* Transfer an archive
* @param string $archiveId The identifier of the archive
*
* @return recordsManagement/archive The archive transferred
*/
public function outgoingTransfer($archiveId)
{
$this->verifyIntegrity($archiveId);
$archive = $this->retrieve($archiveId);
$statusChanged = $this->setStatus((string) $archive->archiveId, "transfered");
$valid = count($statusChanged["success"]) ? true : false;
// Life cycle journal
$this->logOutgoingTransfer($archive, $valid);
return $valid ? $archive : null;
}
}
......@@ -126,7 +126,7 @@ EOD
}
/**
* Get reseult
* Get result
*
* @param Array $events Array of audit/event object
*
......@@ -156,7 +156,7 @@ EOD
if ($multipleInstance) {
$dataTable->setUnsortableColumns(5);
$dataTable->setSorting(array(array(2, 'desc')));
$dataTable->setSorting(array(array(1, 'desc')));
} else {
$dataTable->setUnsortableColumns(4);
$dataTable->setSorting(array(array(0, 'desc')));
......
......@@ -89,6 +89,7 @@ class serviceAccount
$ownerOrganizations = [];
$organizations = [];
foreach ($tabOrganizations as $org) {
if($org->isOrgUnit){
$organizations[] = $org;
......@@ -97,7 +98,22 @@ class serviceAccount
}
}
if($serviceAccount){
if($serviceAccount->servicePrivilege){
$noDescription = true;
foreach ($serviceAccount->servicePrivilege as $servicePrivilege ) {
foreach ($serviceAccount->servicePrivilegeOptions as $option) {
if($servicePrivilege->serviceURI == $option->serviceURI ) {
$servicePrivilege->description = $option->description;
$noDescription = false;
}
}
if($noDescription) {
$servicePrivilege->description = $servicePrivilege->serviceURI;
}
$noDescription = true;
}
foreach ( $organizations as $org) {
if($org->orgId == $serviceAccount->orgId) {
$serviceAccount->orgName = $org->displayName;
......@@ -111,7 +127,6 @@ class serviceAccount
}
}
}
$this->view->addContentFile("auth/serviceAccount/edit.html");
$this->view->setSource("organizations", $organizations);
$this->view->merge($this->view->getElementById("serviceOrgId"));
......
......@@ -314,6 +314,16 @@ class archive
}
}
$dataTable = $this->view->getElementsByClass("dataTable")->item(2)->plugin['dataTable'];
$dataTable->setPaginationType("full_numbers");
$dataTable->setUnsortableColumns(3);
$dataTable->setSorting(array(array(2, 'desc')));
$dataTable = $this->view->getElementsByClass("dataTable")->item(0)->plugin['dataTable'];
$dataTable->setPaginationType("full_numbers");
$dataTable->setUnsortableColumns(2);
$dataTable->setSorting(array(array(0, 'desc')));
//$this->view->setSource("visible", $visible);
$this->view->setSource("archive", $archive);
......
......@@ -1707,3 +1707,6 @@ msgstr "Réinitialisation du compte oublié"
msgid "auth/userAccount/updateResetpassword"
msgstr "Réinitialisation du mot de passe"
msgid "organization/orgContact/readCountriesCodes"
msgstr "Lecture de la liste des pays"
......@@ -57,7 +57,7 @@ msgid "The end date is lower than the begin date."
msgstr "La date de fin est antérieure à la date de début."
msgid "An owner is already defined."
msgstr "Un Opérateur d'Archive est déjà défini."
msgstr "Un Opérateur d'Archivage est déjà défini."
msgid "Role not created"
msgstr "Rôle non créé"
......
......@@ -971,7 +971,3 @@ msgstr "Aucune organisation sélectionnée"
msgid "You have to choose a working organization unit to proceed this action."
msgstr "L'utilisateur courant n'est affecté à aucune organisation. Contactez votre administrateur."
msgid "Code"
msgstr "Nom de la règle"
msgctxt "archiveInformation"
......@@ -35,7 +35,7 @@
<div id="orgGroup" class="form-group hide">
<label class="control-label" for="serviceOrgId">Organization<span> : </span></label>
<input name="ownerOrgName" id="originatorOwnerOrgName" disabled class="form-control">
<!--<span name="ownerOrgName" id="originatorOwnerOrgName"></span>-->
<!--<span name="ownerOrgName" id="originatorOwnerOrgName"></span>-->
</div>
</div>
<div class="form-group">
......@@ -81,10 +81,10 @@
</div>
<div class="tab-pane fade in active" id="privilegesTab" >
<h3>Privileges</h3>
<!-- it's use to clone -->
<div style="display: none" id="privilegeExemple">
<!-- it's use to clone -->
<div style="display: none" id="privilegeExemple">
<div class="input-group" name="privilegeURI">
<input type="text" class="form-control" disabled=""/>
<input type="text" class="form-control" disabled=""/>
<span class="input-group-btn">
<button class="btn btn-danger" type="button" name="btnDeletePrvilege" title="Delete"><span class="fa fa-trash-o"></span></button>
</span>
......@@ -92,12 +92,11 @@
</div>
<div class="form-horizontal" id="listPrivilege">
<div class="input-group">
<!--<select class="form-control">-->
<!--<option value="" >Select a profile</option>-->
<!--<?merge serviceAccount.servicePrivileges.print() ?>-->
<!--<option data-serviceURI="[?merge .serviceURI ?]"><?merge .description ?></option>-->
<!--</select>-->
<input type="text" class="form-control" id="inputPrivilegeURI">
<select class="form-control" id="selectPrivilegeURI">
<option></option>
<?merge serviceAccount.servicePrivilegeOptions?>
<option data-serviceURI="[?merge .serviceURI ?]"><?merge .description ?></option>
</select>
<span class="input-group-btn">
<button class="btn btn-success" type="button" id="btnAddPrvilege" title="Add"><span class="fa fa-plus"></span></button>
</span>
......@@ -106,7 +105,7 @@
<div>
<?merge serviceAccount.servicePrivilege ?>
<div class="input-group" name="privilegeURI">
<input type="text" class="form-control" disabled="" value="[?merge .serviceURI ?]"/>
<input type="text" class="form-control" data-serviceuri="[?merge .serviceURI ?]" disabled="" value="[?merge .description ?]"/>
<span class="input-group-btn">
<button class="btn btn-danger" type="button" name="btnDeletePrvilege" title="Delete"><span class="fa fa-trash-o"></span></button>
</span>
......@@ -129,7 +128,22 @@
<span id="nullValue_text">The fields is empty.</span>
<span id="noServiceFound">No service found</span>
</div>
<script type="application/javascript">
var privileges = [];
$("[name=privilegeURI]").find('input').each(function(){
privileges.push($(this).val());
});
$("#selectPrivilegeURI").find('option').each(function(){
if(privileges.includes($(this).val())) {
$(this).hide();
}
});
//save
$("#submitServiceAccount").on("click", function(){
var url = '/serviceAccount';
......@@ -146,13 +160,13 @@
serviceAccount.accountName = jQuery.trim($("#accountName").val());
serviceAccount.displayName = serviceAccount.accountName;
serviceAccount.emailAddress = '';
//serviceAccount.orgId = $("#serviceOrgId").val();
serviceAccount.enabled = false;
orgId = $("#serviceOrgId").val();
var servicesURI = new Array();
$("#listPrivilege").find("[name=privilegeURI]").each(function(){
servicesURI.push($(this).find("input").val());
servicesURI.push($(this).find("input").data('serviceuri'));
});
if(serviceAccount.displayName == "" || orgId == "") {
......@@ -190,24 +204,26 @@
//Add privilege
$("#btnAddPrvilege").on("click", function(){
var value = $("#inputPrivilegeURI").val();
if (value == "") {
gritter.show($('#nullValue_text').text(),false);
return;
}
var serviceURI = $("#selectPrivilegeURI option:selected").data('serviceuri');
var description = $("#selectPrivilegeURI option:selected").val();
if (/\s/g.test(value)) {
gritter.show($('#whiteSpace_text').text(),false);
return;
}
$("#privilegeExemple").find("[name=privilegeURI]:first")
.clone()
.find('input')
.val(description)
.data("serviceuri",serviceURI)
.closest('[name=privilegeURI]')
.appendTo($("#listPrivilege"));
$("#privilegeExemple").find("[name=privilegeURI]:first").clone().appendTo($("#listPrivilege")).find("input").val($("#inputPrivilegeURI").val());
$("#inputPrivilegeURI").val("");
$("#selectPrivilegeURI").val('').find('option[data-serviceuri="'+serviceURI+'"]').hide();
});
//Delete privilege
$("#privilegesTab").on("click","[name=btnDeletePrvilege]", function(){
var serviceURI = $(this).closest("[name=privilegeURI").find('input').data('serviceuri');
$("#selectPrivilegeURI").val('').find('option[data-serviceuri="'+serviceURI+'"]').show();
$(this).closest("[name=privilegeURI").remove();
});
......@@ -304,4 +320,4 @@
}
});
</script>
</script>
\ No newline at end of file
......@@ -201,7 +201,7 @@
} else {
var select = $('#descriptionClassProperties');
}
select.find('option[value="'+fieldName+'"]').show();
select.find('option[value="'+fieldName+'"]').show();
}
}
......
......@@ -81,7 +81,7 @@
})
archiveInfoModal = {
load: function(archiveId) {
load: function(archiveId, noMessageTab) {
$.ajax({
type : "GET",
url : "/recordsManagement/archiveDescription/" + archiveId,
......@@ -101,6 +101,11 @@
} else {
$('#modalArchiveInfo').modal();
}
if (noMessageTab === true) {
$('#modalArchiveInfo').find('.nav-tabs').find('li:last').remove();
}
}
});
},
......
Markdown is supported
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