From 9ce848cd2a0daa4854669318fb016d7a440858d2 Mon Sep 17 00:00:00 2001 From: "marco.spasiano" Date: Fri, 20 Dec 2024 09:25:12 +0100 Subject: [PATCH] Gestione dei supervisori delle sedi di lavoro --- .../it/cnr/si/cool/jconon/rest/CacheRest.java | 2 ++ .../it/cnr/si/cool/jconon/util/EnvParameter.java | 1 + .../META-INF/js/cnr/cnr.ui.gestorisedi.js | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/rest/CacheRest.java b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/rest/CacheRest.java index 9b33bd0e15..44dccb11be 100644 --- a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/rest/CacheRest.java +++ b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/rest/CacheRest.java @@ -25,6 +25,7 @@ import it.cnr.si.cool.jconon.repository.CommissionConfProperties; import it.cnr.si.cool.jconon.repository.dto.CmisObjectCache; import it.cnr.si.cool.jconon.util.EnvParameter; +import it.cnr.si.cool.jconon.util.JcononGroups; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -90,6 +91,7 @@ protected Map getModel(HttpServletRequest req) { model.put("dataDictionary", folderService.getDataDictionaryId()); model.put("zones", zoneRepository.get()); model.put(EnvParameter.QUERY_INDEX_ENABLE, Boolean.valueOf(env.getProperty(EnvParameter.QUERY_INDEX_ENABLE, "true"))); + model.put(EnvParameter.GROUPS_SUPERVISOR_SEDI, env.getProperty(EnvParameter.GROUPS_SUPERVISOR_SEDI, JcononGroups.CONCORSI.group()).split(",")); model.put("commissionVideoGender", commissionConfProperties.getGender()); final CmisObjectCache competitionFolder = cacheRepository.getCompetitionFolder(); model.put(CacheRepository.COMPETITION, competitionFolder); diff --git a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/util/EnvParameter.java b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/util/EnvParameter.java index b9695b2593..19c7496abe 100644 --- a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/util/EnvParameter.java +++ b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/util/EnvParameter.java @@ -18,4 +18,5 @@ public final class EnvParameter { public static final String QUERY_INDEX_ENABLE = "query.index.enable"; + public static final String GROUPS_SUPERVISOR_SEDI = "groups.supervisor.sedi"; } diff --git a/cool-jconon-webapp-resources/src/main/resources/META-INF/js/cnr/cnr.ui.gestorisedi.js b/cool-jconon-webapp-resources/src/main/resources/META-INF/js/cnr/cnr.ui.gestorisedi.js index d521950b78..2501fa8b2d 100644 --- a/cool-jconon-webapp-resources/src/main/resources/META-INF/js/cnr/cnr.ui.gestorisedi.js +++ b/cool-jconon-webapp-resources/src/main/resources/META-INF/js/cnr/cnr.ui.gestorisedi.js @@ -1,5 +1,5 @@ /*global params*/ -define(['jquery', 'cnr/cnr.url', 'cnr/cnr.ui.select', 'cnr/cnr', 'json!common'], function ($, URL, Select, CNR, common) { +define(['jquery', 'cnr/cnr.url', 'cnr/cnr.ui.select', 'cnr/cnr', 'json!common', 'json!cache'], function ($, URL, Select, CNR, common, cache) { "use strict"; @@ -20,7 +20,7 @@ define(['jquery', 'cnr/cnr.url', 'cnr/cnr.ui.select', 'cnr/cnr', 'json!common'], struttura_destinataria.val(riga[0].citta); sede.val(riga[0].descrizione); } else { - if(common.User.admin || common.User.groupsArray.indexOf("GROUP_CONCORSI") !== -1) { + if(common.User.admin || isGestore()) { struttura_destinataria.prop('disabled', false); sede.prop('disabled', false); } @@ -33,6 +33,17 @@ define(['jquery', 'cnr/cnr.url', 'cnr/cnr.ui.select', 'cnr/cnr', 'json!common'], }); select.trigger("change", true); } + + function isGestore() { + var gestore = false; + cache['groups.supervisor.sedi'].forEach(function(group) { + if (common.User.groupsArray.indexOf(group) !== -1) { + gestore = true; + } + }); + return gestore; + } + function widget(id, labelText, item) { var obj = Select.CustomWidget(id, labelText, item), callType = params['call-type'],