Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 6f7c6aff authored by Timothée Collard's avatar Timothée Collard
Browse files

[EVSCLT-875] WIP for simplify the visibility management of validations and logs

parent 32ebc9c0
Pipeline #268589 failed with stages
in 5 minutes and 5 seconds
......@@ -24,6 +24,8 @@ package net.ihe.gazelle.evs.client.common.menu;
import net.ihe.gazelle.common.application.action.ApplicationPreferenceManager;
import net.ihe.gazelle.common.pages.Authorization;
import net.ihe.gazelle.evsclient.authentication.SSOIdentity;
import net.ihe.gazelle.preferences.PreferenceService;
import org.jboss.seam.security.Identity;
public enum Authorizations implements Authorization {
......@@ -40,22 +42,25 @@ public enum Authorizations implements Authorization {
@Override
public boolean isGranted(final Object... context) {
boolean userIsLoggedIfNeeded = !PreferenceService.getBoolean("user_need_to_be_logged_in")
|| Identity.instance().isLoggedIn();
switch (this) {
case ALL:
return true;
case LOGGED:
return Identity.instance().isLoggedIn();
return userIsLoggedIfNeeded;
case ADMIN:
return Identity.instance().hasRole("admin_role");
case MONITOR:
return Identity.instance().hasRole("monitor_role");
case SCHEMATRON:
return ApplicationPreferenceManager.getBooleanValue("display_SCHEMATRON_menu");
return ApplicationPreferenceManager.getBooleanValue("display_SCHEMATRON_menu")
&& userIsLoggedIfNeeded;
case CROSS_VALIDATION:
return ApplicationPreferenceManager.getBooleanValue("x_validation_enabled");
return ApplicationPreferenceManager.getBooleanValue("x_validation_enabled")
&& userIsLoggedIfNeeded;
default:
return false;
}
}
}
......@@ -69,9 +69,6 @@ public class EVSMenu {
// all elements
final ArrayList<Menu> children = new ArrayList<>();
// Customized menu begins here
final EVSMenuGroupQuery query = new EVSMenuGroupQuery();
query.available().eq(Boolean.TRUE);
......@@ -97,7 +94,7 @@ public class EVSMenu {
}
}
}
EVSMenu.addMenu(children, groupItems, group.getLabel(), group.getIconPath(), group.getVisibleToAll()?Authorizations.ALL:Authorizations.LOGGED);
EVSMenu.addMenu(children, groupItems, group.getLabel(), group.getIconPath());
}
}
......@@ -118,8 +115,8 @@ public class EVSMenu {
EVSMenu.addValidate(dicomTools, "/dicom/SCPValidator.xhtml", "DICOM SCP Screener");
EVSMenu.addLogs(dicomTools, "/dicom/SCPValidatorResult.xhtml", "DICOM SCP Screener Logs");
EVSMenu.addMenu(addOnsMenu, detectorItems, "Message Content Analyzer", "fa fa-barcode", Authorizations.ALL);
EVSMenu.addMenu(addOnsMenu, dicomTools, "Dicom Tools", "gzl-font gzl-dicom", Authorizations.ALL);
EVSMenu.addMenu(addOnsMenu, detectorItems, "Message Content Analyzer", "fa fa-barcode");
EVSMenu.addMenu(addOnsMenu, dicomTools, "Dicom Tools", "gzl-font gzl-dicom");
// Cross Validator
final List<Menu> xvalidation = new ArrayList<>();
......@@ -129,7 +126,7 @@ public class EVSMenu {
EVSMenu.addMenu(addOnsMenu, xvalidation, "Gazelle Cross Validation", "fa fa-sitemap", Authorizations.CROSS_VALIDATION);
if (Boolean.valueOf(PreferenceService.getString("x_validation_editor"))) {
if (Boolean.parseBoolean(PreferenceService.getString("x_validation_editor"))) {
final List<Menu> xvalidationAdmin = new ArrayList<>();
xvalidationAdmin.add(new MenuEntry(XValidationPages.ADMIN_IMPORT_VALIDATORS));
......@@ -142,7 +139,7 @@ public class EVSMenu {
addOnsMenu.add(new MenuEntry(Pages.STATISTICS));
addOnsMenu.add(new MenuEntry(Pages.API_KEY_MANAGEMENT));
EVSMenu.addMenu(children, addOnsMenu, "Add-ons", "fa fa-wrench", Authorizations.ALL);
EVSMenu.addMenu(children, addOnsMenu, "Add-ons", "fa fa-wrench");
}
// Administration Menu
......@@ -199,8 +196,12 @@ public class EVSMenu {
items.add(new MenuEntry(new PageStatistics(type)));
}
private static void addMenu(final List<Menu> parentItems, final List<Menu> items, final String title, final String img) {
addMenu(parentItems, items, title, img, Authorizations.LOGGED);
}
private static void addMenu(final List<Menu> parentItems, final List<Menu> items, final String title, final String img,
final Authorization... authorizations) {
final Authorization... authorizations) {
EVSMenu.LOGGER.debug("adding menu :{} {}", title, img);
parentItems.add(new MenuGroup(new PageMenu(title, img, authorizations), items));
}
......
......@@ -96,11 +96,7 @@ public class PageLogs implements Page {
@Override
public Authorization[] getAuthorizations() {
if(PreferenceService.getBoolean("user_need_to_be_logged_in")){
return new Authorization[]{Authorizations.LOGGED};
} else {
return new Authorization[]{Authorizations.ALL};
}
return new Authorization[]{ Authorizations.LOGGED };
}
@Override
......
......@@ -35,16 +35,11 @@ public class PageMenu implements Page {
private Authorization[] authorizations;
public PageMenu(final String title, final String img, final Authorization... authorizations) {
this(title, img);
this.authorizations = authorizations.clone();
}
public PageMenu(final String title, final String img) {
this.title = title;
this.img = img;
this.id = "menu_" + this.iMenu;
this.iMenu++;
this.authorizations = new Authorization[] { Authorizations.ALL };
this.authorizations = authorizations.clone();
}
@Override
......
......@@ -76,7 +76,7 @@ public class PageStatistics implements Page {
@Override
public Authorization[] getAuthorizations() {
return new Authorization[] { Authorizations.ALL };
return new Authorization[]{ Authorizations.LOGGED };
}
@Override
......
......@@ -95,11 +95,7 @@ public class PageValidate implements Page {
@Override
public Authorization[] getAuthorizations() {
if(PreferenceService.getBoolean("user_need_to_be_logged_in")){
return new Authorization[]{Authorizations.LOGGED};
} else {
return new Authorization[]{Authorizations.ALL};
}
return new Authorization[]{ Authorizations.LOGGED };
}
@Override
......
......@@ -26,29 +26,22 @@ import net.ihe.gazelle.common.pages.Page;
public enum Pages implements Page {
HOME("/home.xhtml", "fa-wrench", "gazelle.evs.client.home",
Authorizations.ALL),
HOME("/home.xhtml", "fa-wrench", "gazelle.evs.client.home", Authorizations.ALL),
VALIDATE("/validate.xhtml", "fa-wrench", "gazelle.evs.client.validate",
Authorizations.ALL),
VALIDATE("/validate.xhtml", "fa-wrench", "gazelle.evs.client.validate"),
SCHEMATRONS("/administration/schematrons.xhtml", "fa-file-text", "gazelle.evs.client.cda.schematrons.title",
Authorizations.SCHEMATRON),
STATISTICS("/administration/statistics.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics",
Authorizations.ALL),
STATISTICS("/administration/statistics.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics"),
STATISTICS_BY_TYPE("/administration/statisticsByType.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics",
Authorizations.ALL),
STATISTICS_BY_TYPE("/administration/statisticsByType.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics"),
ERROR("/error.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics",
Authorizations.ALL),
ERROR("/error.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics"),
MESSAGE_CONTENT_ANALYZER("/messageContentAnalyzer.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics",
Authorizations.ALL),
MESSAGE_CONTENT_ANALYZER("/messageContentAnalyzer.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics"),
MESSAGE_CONTENT_ANALYZER_RESULT("/messageContentAnalyzerDetailedResult.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics",
Authorizations.ALL),
MESSAGE_CONTENT_ANALYZER_RESULT("/messageContentAnalyzerDetailedResult.xhtml", "fa-bar-chart", "gazelle.evs.client.statistics"),
VALIDATION_SERVICES("/administration/validationServices.xhtml", "fa-wrench",
"gazelle.evs.client.admin.menu.services", Authorizations.ADMIN),
......@@ -77,43 +70,32 @@ public enum Pages implements Page {
MENU_CONFIG("/administration/menuConfiguration.xhtml", "fa-wrench",
"gazelle.evs.client.admin.menu.menuConfiguration", Authorizations.ADMIN),
API_KEY_MANAGEMENT("/administration/apiKeyManagement.xhtml", "fa-key", "API Key Management",
Authorizations.LOGGED),
API_KEY_MANAGEMENT("/administration/apiKeyManagement.xhtml", "fa-key", "API Key Management"),
MCA_CONFIG("/config/messageContentAnalyzerConfig.xhtml", "fa-wrench",
"Message Content Analyzer Configuration", Authorizations.ALL),
"Message Content Analyzer Configuration"),
DETAILED_RESULT("/detailedResult.xhtml", "fa-wrench", "gazelle.evs.client.result",
Authorizations.ALL),
DETAILED_RESULT("/detailedResult.xhtml", "fa-wrench", "gazelle.evs.client.result"),
DICOM_RESULT("/dicomResult.xhtml", "fa-wrench", "gazelle.evs.client.dicomresult",
Authorizations.ALL),
DICOM_RESULT("/dicomResult.xhtml", "fa-wrench", "gazelle.evs.client.dicomresult"),
DICOM_SCP_RESULT("/dicomSCPScreenerResult.xhtml", "fa-wrench", "gazelle.evs.client.dicomscpresult",
Authorizations.ALL),
DICOM_SCP_RESULT("/dicomSCPScreenerResult.xhtml", "fa-wrench", "gazelle.evs.client.dicomscpresult"),
DICOM_WEB_RESULT("/dicomWebResult.xhtml", "fa-wrench", "gazelle.evs.client.dicomwebresult",
Authorizations.ALL),
DICOM_WEB_RESULT("/dicomWebResult.xhtml", "fa-wrench", "gazelle.evs.client.dicomwebresult"),
HL7V2_RESULT("/hl7v2Result.xhtml", "fa-wrench", "gazelle.evs.client.hl7v2result",
Authorizations.ALL),
HL7V2_RESULT("/hl7v2Result.xhtml", "fa-wrench", "gazelle.evs.client.hl7v2result"),
INITIALIZATION_ERROR("/initializationError.xhtml", "fa-wrench", "gazelle.evs.client.initializationerror",
Authorizations.ALL),
INITIALIZATION_ERROR("/initializationError.xhtml", "fa-wrench", "gazelle.evs.client.initializationerror"),
LOGGED_IN("/loggedIn.xhtml", "fa-wrench", "gazelle.evs.client.loggedin",
Authorizations.ALL),
LOGGED_IN("/loggedIn.xhtml", "fa-wrench", "gazelle.evs.client.loggedin"),
PDF_RESULT("/pdfResult.xhtml", "fa-wrench", "gazelle.evs.client.pdfresult",
Authorizations.ALL),
PDF_RESULT("/pdfResult.xhtml", "fa-wrench", "gazelle.evs.client.pdfresult"),
TLS_RESULT("/tlsResult.xhtml", "fa-wrench", "gazelle.evs.client.tlsresult",
Authorizations.ALL),
TLS_RESULT("/tlsResult.xhtml", "fa-wrench", "gazelle.evs.client.tlsresult"),
WADO_RESULT("/wadoResult.xhtml", "fa-wrench", "gazelle.evs.client.wadoresult",
Authorizations.ALL),
WORLD_MAP("/worldMap.xhtml", "fa-wrench", "WorlMap",
Authorizations.ALL);
WADO_RESULT("/wadoResult.xhtml", "fa-wrench", "gazelle.evs.client.wadoresult"),
WORLD_MAP("/worldMap.xhtml", "fa-wrench", "WorlMap");
private String link;
......@@ -124,6 +106,10 @@ public enum Pages implements Page {
private final String icon;
Pages(final String link, final String icon, final String label) {
this(link, icon, label, Authorizations.LOGGED);
}
Pages(final String link, final String icon, final String label, final Authorization... authorizations) {
this.link = link;
this.authorizations = authorizations.clone();
......
......@@ -63,10 +63,6 @@ public class EVSMenuGroup implements Serializable {
@Column(name = "order_in_gui")
private Integer orderInGui;
@Column(name = "visible_to_all")
private Boolean visibleToAll;
@ManyToMany
@JoinTable(name = "evsc_menu_standard",
joinColumns = @JoinColumn(name = "menu_group_id"),
......@@ -81,7 +77,6 @@ public class EVSMenuGroup implements Serializable {
this.standards = new ArrayList<>();
this.available = Boolean.FALSE;
this.orderInGui = 0;
this.visibleToAll = Boolean.TRUE;
}
public Boolean getCreation() {
......@@ -92,9 +87,6 @@ public class EVSMenuGroup implements Serializable {
this.creation = creation;
}
public EVSMenuGroup save() throws PersistenceException {
final EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
final EVSMenuGroup menuGroup = entityManager.merge(this);
......@@ -137,13 +129,6 @@ public class EVSMenuGroup implements Serializable {
this.available = available;
}
public void setVisibleToAll(final Boolean visibleToAll) {
this.visibleToAll = visibleToAll;
}
public Boolean getVisibleToAll() {
return Boolean.valueOf(this.visibleToAll != null && this.visibleToAll);
}
public List<ReferencedStandard> getStandards() {
return this.standards;
}
......@@ -157,8 +142,6 @@ public class EVSMenuGroup implements Serializable {
}
}
@Override
public int hashCode() {
final int prime = 31;
......
......@@ -21,6 +21,8 @@
package net.ihe.gazelle.evs.client.common.action;
import net.ihe.gazelle.common.application.action.ApplicationPreferenceManager;
import net.ihe.gazelle.common.model.ApplicationPreference;
import net.ihe.gazelle.evs.client.common.model.ApiKey;
import net.ihe.gazelle.evsclient.authentication.SSOIdentity;
import net.ihe.gazelle.preferences.PreferenceService;
......
......@@ -63,11 +63,13 @@
<h:outputText value="#{messages['gazelle.common.yes']}" rendered="#{group.available}"/>
<h:outputText value="#{messages['gazelle.common.no']}" rendered="#{not group.available}"/>
</g:column>
<!-- TO REMOVE + CROWDIN KEY -->
<g:column>
<ui:define name="header">#{messages['net.ihe.gazelle.evs.VisibleToAll']}</ui:define>
<h:outputText value="#{messages['gazelle.common.yes']}" rendered="#{group.visibleToAll}"/>
<h:outputText value="#{messages['gazelle.common.no']}" rendered="#{not group.visibleToAll}"/>
</g:column>
<!-- END -->
<g:column>
<ui:define name="header">#{messages['gazelle.evs.client.StandardsToDisplay']}</ui:define>
<rich:list value="#{group.standards}" var="std" type="unordered">
......@@ -158,6 +160,7 @@
#{messages['gazelle.evs.client.isAvailable']}
</s:decorate>
<!-- TO REMOVE + CROWDIN KEYS -->
<s:decorate template="/layout/form/_form_checkbox_horizontal_inline.xhtml">
<ui:param name="id" value="visibleToAllCheckBox"/>
<h:selectBooleanCheckbox id="visibleToAllCheckBox" styleClass="form-control" value="#{menuGroupManager.selectedMenuGroup.visibleToAll}"/>
......@@ -165,6 +168,7 @@
<h:outputText value="#{messages['net.ihe.gazelle.evs.IfThisOptionIsSetTotrueEvenAnonymousUsersWillBeA']}"
styleClass="help-block"/>
</s:decorate>
<!-- END -->
<s:decorate template="/layout/form/_form_field_horizontal_3-9.xhtml">
<ui:param name="id" value="standardId"/>
......
......@@ -32,6 +32,11 @@
<h:form id="globalForm">
#{homeManagerBean.initializeHome()}
<!-- TODO Better UI -->
<s:div styleClass="form-horizontal" rendered="#{not identity.isLoggedIn()}">
<h:outputText value="If no menu is visible please log in to access the services"/>
</s:div>
<s:div id="mainContentRegion" >
<ui:decorate template="/layout/panels/_panel_title_id.xhtml">
......@@ -75,7 +80,6 @@
<h:outputText value="#{messages['gazelle.evs.noHomeContent']}"
rendered="#{empty homeManagerBean.selectedHome.mainContent}"/>
</s:div>
</ui:decorate>
</s:div>
</h:form>
......
......@@ -73,7 +73,7 @@
<sonar.web.sourceDirectory>EVSClient-ui/src/main/webapp</sonar.web.sourceDirectory>
<sonar.exclusions>file:**/generated-sources/**</sonar.exclusions>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gazelle.x.validation.version>1.4.4</gazelle.x.validation.version>
<gazelle.x.validation.version>1.4.5-SNAPSHOT</gazelle.x.validation.version>
<gazelle.ws.client.version>2.2.11</gazelle.ws.client.version>
<gazelle.validator.unit.testing.version>1.0.7</gazelle.validator.unit.testing.version>
<maven.compiler.target>1.7</maven.compiler.target>
......
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