diff --git a/README.md b/README.md index b756f38b8630143f7fdc50ae0682d71c173936a8..cec0db06b27fd39278ae69095a42d44a1063ec3d 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ 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. diff --git a/data/maarchRM/conf/configuration.ini.default b/data/maarchRM/conf/configuration.ini.default index bea0be42fc124b8a336693eb5116d227a9bda068..0628ca59dc1262c77d60c29724524d81708ec8e5 100755 --- a/data/maarchRM/conf/configuration.ini.default +++ b/data/maarchRM/conf/configuration.ini.default @@ -131,6 +131,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 diff --git a/src/bundle/auth/Controller/serviceAccount.php b/src/bundle/auth/Controller/serviceAccount.php index 580a012dee0eb35e3aa0125238a2f054efa24248..ba99cdd3083a529e3584bd015669c7be1fc4393b 100755 --- a/src/bundle/auth/Controller/serviceAccount.php +++ b/src/bundle/auth/Controller/serviceAccount.php @@ -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; diff --git a/src/presentation/maarchRM/Presenter/auth/serviceAccount.php b/src/presentation/maarchRM/Presenter/auth/serviceAccount.php index 2ed8728075fa576d315941a1927bd3f42e4b25ab..5e6cb95596f9fb46380c33ac8d2caaebbdad1693 100755 --- a/src/presentation/maarchRM/Presenter/auth/serviceAccount.php +++ b/src/presentation/maarchRM/Presenter/auth/serviceAccount.php @@ -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")); diff --git a/src/presentation/maarchRM/Resources/locale/fr/recordsManagement/messages.po b/src/presentation/maarchRM/Resources/locale/fr/recordsManagement/messages.po index fc2101381f473efb67ba0dfdbe102a852144792b..e4bb91e7a2676c142262892c8b3e693dd7c1bcae 100755 --- a/src/presentation/maarchRM/Resources/locale/fr/recordsManagement/messages.po +++ b/src/presentation/maarchRM/Resources/locale/fr/recordsManagement/messages.po @@ -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" diff --git a/src/presentation/maarchRM/Resources/view/auth/serviceAccount/edit.html b/src/presentation/maarchRM/Resources/view/auth/serviceAccount/edit.html index 81f5e73d95b8d0ad23a356151b2fbeffa23a973f..8e4160b4a437d4ffdbf40675046f2ddaba8125fa 100755 --- a/src/presentation/maarchRM/Resources/view/auth/serviceAccount/edit.html +++ b/src/presentation/maarchRM/Resources/view/auth/serviceAccount/edit.html @@ -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 diff --git a/src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/descriptionTab.html b/src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/descriptionTab.html index 17e927ec81919e8e2d2fd72a22dc21ed143e0df1..43c28588e3566d47192bf239515201978daeff41 100755 --- a/src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/descriptionTab.html +++ b/src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/descriptionTab.html @@ -201,7 +201,7 @@ } else { var select = $('#descriptionClassProperties'); } - select.find('option[value="'+fieldName+'"]').show(); + select.find('option[value="'+fieldName+'"]').show(); } }