Skip to content

Commit

Permalink
Feature/ivyportal 16892 hide case creator info (#941)
Browse files Browse the repository at this point in the history
* feature/IVYPORTAL-16892-Hide-case-creator-info
_ Create Variable
_ Update UI 
_ Refactor Global Setting Service to Singleton
_ Check GUI test
_ Handle Feedback
  • Loading branch information
nhthinh-axonivy authored Aug 13, 2024
1 parent b08ccb4 commit b250346
Show file tree
Hide file tree
Showing 50 changed files with 257 additions and 119 deletions.
3 changes: 3 additions & 0 deletions AxonIvyPortal/portal/cms/cms_de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ ch.ivy.addon.portalkit.ui.jsf:
enableScriptCheckingForUploadedDocumentNote: 'Auf "true" setzen, um die Skriptüberprüfung zu aktivieren. Es werden die Formate PDF, Excel und Word unterstützt. '
enableVirusScannerForUploadedDocumentNote: Auf true setzen, um den Virenscanner für das hochgeladene Dokument zu aktivieren. Derzeit verwendet diese Funktion die API VIRUSTOTAL.
expressEndPageNote: Anzeigen der angepassten Endseite nach dem Ende eines Express Prozesses.
hideCaseCreator: |
Auf true setzen, um den Fallersteller in der Fallliste, dem Fall-Widget und den Falldetails auszublenden.
Diese Einstellung wirkt sich auf alle Fallabfragen aus, z. B. für Fallliste, globale Suche, Statistik.
hideCaseDocument: Auf "true" setzen, um die Dokumentensektion in Vorgangsdetails auszublenden.
hideChangePasswordButtonNote: Setzen Sie diese Variable auf true, um die Option "Passwort ändern" im oberen Menü und die Option "Passwort vergessen" auf der Anmeldeseite auszublenden. Wenn sie auf false gesetzt ist, werden diese Optionen angezeigt.
hideLogoutButtonNote: 'Auf "true" setzen, um die Logout Funktion im Top Menu zu deaktivieren. '
Expand Down
3 changes: 3 additions & 0 deletions AxonIvyPortal/portal/cms/cms_en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ ch.ivy.addon.portalkit.ui.jsf:
enableScriptCheckingForUploadedDocumentNote: Set to true to enable script checking for uploaded document. Currently this function supports checking for PDF, Excel, Word.
enableVirusScannerForUploadedDocumentNote: Set to true to enable virus scanner for uploaded document. Currently this function is using API VIRUSTOTAL.
expressEndPageNote: Display the custom end page at the end of each Express process.
hideCaseCreator: |-
Set to true to hide case creator in case list, case widget and case details.
This setting affects all case queries, e.g. for case list, global search, statistic.
hideCaseDocument: Set to true, the document section in case detail page will be hidden, otherwise it will be shown.
hideChangePasswordButtonNote: Set this variable to true to hide the "Change Password" option in the top menu and the "Forgotten Password" option on the login page. If set to false, these options will be shown.
hideLogoutButtonNote: If true, the logout button on top menu will be hidden, otherwise it will be shown.
Expand Down
3 changes: 3 additions & 0 deletions AxonIvyPortal/portal/cms/cms_es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ ch.ivy.addon.portalkit.ui.jsf:
enableScriptCheckingForUploadedDocumentNote: 'Cambiar a "True" para activar el control de anexos permitidos. De momento se pueden controlar archivos en PDF, word y excel. '
enableVirusScannerForUploadedDocumentNote: Cambiar a "true" para habilitar el escáner de virus para el documento cargado. Actualmente esta función utiliza la API VIRUSTOTAL.
expressEndPageNote: Mostrar la página de final de flujo de trabajo express propia.
hideCaseCreator: |-
Establecer a true para ocultar el creador de casos en la lista de casos, widget de casos y detalles de casos.
Este ajuste afecta a todas las consultas de casos, por ejemplo, para la lista de casos, la búsqueda global o la estadística.
hideCaseDocument: Cambiar a "true" para ocultar el área de documentos en detalle de casos
hideChangePasswordButtonNote: Establezca esta variable a true para ocultar la opción "Cambiar contraseña" en el menú superior y la opción "Contraseña olvidada" en la página de inicio de sesión. Si se establece en false, estas opciones se mostrarán.
hideLogoutButtonNote: Cambiar a "true" para ocultar la opción de logout.
Expand Down
3 changes: 3 additions & 0 deletions AxonIvyPortal/portal/cms/cms_fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ ch.ivy.addon.portalkit.ui.jsf:
enableScriptCheckingForUploadedDocumentNote: Défini sur true pour activer la vérification de script pour le document téléchargé. Actuellement, cette fonction prend en charge la vérification de PDF, Excel, Word.
enableVirusScannerForUploadedDocumentNote: Définie sur true pour activer le scanner de virus pour le document téléchargé. Actuellement, cette fonction utilise l'API VIRUSTOTAL.
expressEndPageNote: Affiche la page de fin personnalisée à la fin de chaque processus Express.
hideCaseCreator: |-
La valeur "true" permet de masquer le créateur du dossier dans la liste des dossiers, le widget du dossier et les détails du dossier.
Ce paramètre affecte toutes les requêtes de cas, par exemple pour la liste des cas, la recherche globale, les statistiques.
hideCaseDocument: Si vous choisissez "true", la section du document dans la page de détail du cas sera invisible, sinon elle sera visible.
hideChangePasswordButtonNote: Attribuez la valeur true à cette variable pour masquer l'option "Changer de mot de passe" dans le menu supérieur et l'option "Mot de passe oublié" sur la page de connexion. Si elle vaut false, ces options seront affichées.
hideLogoutButtonNote: Si true, le bouton de déconnexion du menu supérieur sera masqué, sinon il sera affiché.
Expand Down
4 changes: 4 additions & 0 deletions AxonIvyPortal/portal/config/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ Variables:
# [enum: ASC, DESC]
SortDirection: DESC

# Set to true to hide case creator in case list, case widget and case details.
# This setting affects all case queries, e.g. for case list, global search, statistic.
HideCaseCreator: false

# You can configure the look and feel for case details according to your needs via this json file.
# This setting will be taken over for all other case details.
# [file: json]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private record PortalSubMenuItemWrapper(Locale loadedLocale, List<SubMenuItem> p

private static List<SubMenuItem> getSubmenuList() {
List<SubMenuItem> subMenuItems = new ArrayList<>();
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();

if(PermissionUtils.checkAccessFullProcessListPermission()) {
subMenuItems.add(new ProcessSubMenuItem());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static Homepage findDefaultHomepage() {
}

private static String findHomepageSetting() {
return new GlobalSettingService().findGlobalSettingValue(GlobalVariable.DEFAULT_HOMEPAGE);
return GlobalSettingService.getInstance().findGlobalSettingValue(GlobalVariable.DEFAULT_HOMEPAGE);
}

public static Map<String, String> getHomepageOptionsForAdminSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,11 @@ private boolean isChatResponseTimeoutConfigured() {
}

private String getChatResponseTimeoutValue() {
return new GlobalSettingService().findGlobalSettingValue(CHAT_RESPONSE_TIMEOUT);
return GlobalSettingService.getInstance().findGlobalSettingValue(CHAT_RESPONSE_TIMEOUT);
}

private int getMaxChatConnectionPerUser() {
String maxConnection = new GlobalSettingService().findGlobalSettingValue(CHAT_MAX_CONNECTION);
String maxConnection = GlobalSettingService.getInstance().findGlobalSettingValue(CHAT_MAX_CONNECTION);
int maxConnectionNumber = 0;
try {
if (StringUtils.isNotBlank(maxConnection)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean getIsChatRendered() {

public boolean getIsGroupChatRendered() {
if (isGroupChatRendered == null) {
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();
String enableGroupChatCreation = globalSettingService.findGlobalSettingValue(GlobalVariable.ENABLE_GROUP_CHAT);
if (StringUtils.isBlank(enableGroupChatCreation)) {
Map<String, Object> response = IvyAdapterService.startSubProcessInSecurityContext("activateGroupChat()", null);
Expand All @@ -45,7 +45,7 @@ public boolean getIsGroupChatRendered() {

public boolean getIsPrivateChatRendered() {
if (isPrivateChatRendered == null) {
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();
String enablePrivateChat = globalSettingService.findGlobalSettingValue(GlobalVariable.ENABLE_PRIVATE_CHAT);
isPrivateChatRendered = Boolean.parseBoolean(enablePrivateChat);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,14 @@ private List<String> standardFields() {
}
} else if (widget.getType() == DashboardWidgetType.CASE) {
var enableCaseOwner = GlobalSettingService.getInstance().isCaseOwnerEnabled();
boolean disableCaseCreator = GlobalSettingService.getInstance().isHideCaseCreator();
for (DashboardStandardCaseColumn col : DashboardStandardCaseColumn.values()) {
if (!enableCaseOwner && DashboardStandardCaseColumn.OWNER == col) {
continue;
}
if (disableCaseCreator && DashboardStandardCaseColumn.CREATOR == col) {
continue;
}
standardFields.add(col.getField());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,8 @@ public String getSelectedDashboardName() {
}
return selectedDashboardName;
}

public boolean isHideCaseCreator() {
return GlobalSettingService.getInstance().isHideCaseCreator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class StatisticBean implements Serializable {

@PostConstruct
public void init() {
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();
isHideStatisticWidget =
globalSettingService.findGlobalSettingValue(GlobalVariable.HIDE_STATISTIC_WIDGET);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public String getDisplayNameOfTaskSortField(String sortField) {
List<String> sortFieldNames = Stream.of(TaskSortField.values()).map(Enum::name).collect(Collectors.toList());

if (StringUtils.equals(sortField, DEFAULT)) {
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();
String defaultSortField = globalSettingService
.findGlobalSettingByGlobalVariable(GlobalVariable.DEFAULT_SORT_FIELD_OF_TASK_LIST).getValue();

Expand All @@ -80,7 +80,7 @@ public String getDisplayNameOfTaskSortField(String sortField) {
public String getDisplayNameOfCaseSortField(String sortField) {
List<String> sortFieldNames = Stream.of(CaseSortField.values()).map(Enum::name).collect(Collectors.toList());
if (StringUtils.equals(sortField, DEFAULT)) {
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();
String defaultSortField = globalSettingService
.findGlobalSettingByGlobalVariable(GlobalVariable.DEFAULT_SORT_FIELD_OF_CASE_LIST).getValue();

Expand All @@ -96,7 +96,7 @@ public String getDisplayNameOfCaseSortField(String sortField) {
public String getDisplayNameOfTaskSortDirection(String sortDirection) {
List<String> sortDirectionNames = Stream.of(SortDirection.values()).map(Enum::name).collect(Collectors.toList());
if (StringUtils.equals(sortDirection, DEFAULT)) {
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();
String defaultDirection = globalSettingService
.findGlobalSettingByGlobalVariable(GlobalVariable.DEFAULT_SORT_DIRECTION_OF_TASK_LIST).getValue();

Expand All @@ -111,7 +111,7 @@ public String getDisplayNameOfTaskSortDirection(String sortDirection) {
public String getDisplayNameOfCaseSortDirection(String sortDirection) {
List<String> sortDirectionNames = Stream.of(SortDirection.values()).map(Enum::name).collect(Collectors.toList());
if (StringUtils.equals(sortDirection, DEFAULT)) {
GlobalSettingService globalSettingService = new GlobalSettingService();
GlobalSettingService globalSettingService = GlobalSettingService.getInstance();
String defaultDirection = globalSettingService
.findGlobalSettingByGlobalVariable(GlobalVariable.DEFAULT_SORT_DIRECTION_OF_CASE_LIST).getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void initConfig() {
.build();
}

globalSettingService = new GlobalSettingService();
globalSettingService = GlobalSettingService.getInstance();
isShowNotAvailableData = PermissionUtils.isSessionUserHasAdminRole();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public class AvatarBean implements Serializable {
private static final long serialVersionUID = 1L;

public boolean isShowAvatar() {
return new GlobalSettingService().findGlobalSettingValueAsBoolean(GlobalVariable.SHOW_AVATAR);
return GlobalSettingService.getInstance().findGlobalSettingValueAsBoolean(GlobalVariable.SHOW_AVATAR);
}
}
32 changes: 28 additions & 4 deletions AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/bean/CaseBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.Date;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.apache.commons.lang3.StringUtils;

Expand All @@ -20,10 +22,19 @@
import ch.ivyteam.ivy.workflow.caze.CaseBusinessState;

@ManagedBean(name = "caseBean")
@ViewScoped
public class CaseBean implements Serializable {
private static final long serialVersionUID = 1L;

private static final String OPEN_CASES_LIST = "Start Processes/PortalStart/CaseListPage.ivp";
private boolean isHideCaseCreator;
private boolean isCaseOwnerEnabled;

@PostConstruct
public void init() {
isCaseOwnerEnabled = GlobalSettingService.getInstance().isCaseOwnerEnabled();
isHideCaseCreator = GlobalSettingService.getInstance().isHideCaseCreator();
}

/**
* Get the state of case
Expand Down Expand Up @@ -54,10 +65,6 @@ public void backToCasesList() {
}
}

public boolean isCaseOwnerEnabled() {
return new GlobalSettingService().isCaseOwnerEnabled();
}

public String getDurationOfCase(ICase iCase) {
return iCase.getEndTimestamp() != null ? getElapsedTimeForDoneCase(iCase) : getElapsedTimeForRunningCase(iCase);
}
Expand Down Expand Up @@ -86,4 +93,21 @@ private String getElapsedTimeForRunningCaseOnTooltip(ICase iCase) {
long duration = TimesUtils.getDurationInSeconds(iCase.getStartTimestamp(), new Date());
return DateTimeFormatterUtils.formatToExactTime(duration);
}

public boolean isHideCaseCreator() {
return isHideCaseCreator;
}

public void setHideCaseCreator(boolean isHideCaseCreator) {
this.isHideCaseCreator = isHideCaseCreator;
}

public boolean isCaseOwnerEnabled() {
return isCaseOwnerEnabled;
}

public void setCaseOwnerEnabled(boolean isCaseOwnerEnabled) {
this.isCaseOwnerEnabled = isCaseOwnerEnabled;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ public class CaseDetailsBean extends AbstractConfigurableContentBean<CaseDetails
private String caseDetailsDescription;
private String caseDetailsUrl;
private Boolean isShowShareButton;
private boolean isHideCaseCreator;

public void init() {
super.initConfig();
isHideCaseDocument = new GlobalSettingService().findGlobalSettingValueAsBoolean(GlobalVariable.HIDE_CASE_DOCUMENT);
isHideCaseDocument = GlobalSettingService.getInstance().findGlobalSettingValueAsBoolean(GlobalVariable.HIDE_CASE_DOCUMENT);
caseActionBean = ManagedBeans.get("caseActionBean");
isFirstTime = true;
isShowShareButton = PermissionUtils.hasShareCaseDetailsPermission();
isRunningTaskWhenClickingOnTaskInList = new GlobalSettingService()
isHideCaseCreator = GlobalSettingService.getInstance().isHideCaseCreator();
isRunningTaskWhenClickingOnTaskInList = GlobalSettingService.getInstance()
.findGlobalSettingValue(GlobalVariable.DEFAULT_BEHAVIOUR_WHEN_CLICKING_ON_LINE_IN_TASK_LIST)
.equals(BehaviourWhenClickingOnLineInTaskList.RUN_TASK.name());
}
Expand Down Expand Up @@ -324,4 +326,13 @@ public Boolean getIsShowShareButton() {
public void setIsShowShareButton(Boolean isShowShareButton) {
this.isShowShareButton = isShowShareButton;
}

public boolean isHideCaseCreator() {
return isHideCaseCreator;
}

public void setHideCaseCreator(boolean isHideCaseCreator) {
this.isHideCaseCreator = isHideCaseCreator;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void fetchStatisticCharts() {
}

public void initSettings() {
var chartScalingSetting = new GlobalSettingService().findGlobalSettingValue(GlobalVariable.STATISTIC_CHART_SCALING_INTERVAL);
var chartScalingSetting = GlobalSettingService.getInstance().findGlobalSettingValue(GlobalVariable.STATISTIC_CHART_SCALING_INTERVAL);
statisticChartScalingInterval = StringUtils.isNotBlank(chartScalingSetting) ? Long.valueOf(chartScalingSetting) : 0;
isRenderedRefreshChartPoll = statisticChartScalingInterval > StatisticChartCreationBean.MINIMUM_STATISTIC_CHART_SCALING_INTERVAL
&& !Ivy.session().isSessionUserUnknown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public String getProcessElement() {
}

public boolean getIsShowErrorLogToConsole() {
return new GlobalSettingService().findGlobalSettingValueAsBoolean(GlobalVariable.SHOW_ERROR_LOG_TO_CONSOLE);
return GlobalSettingService.getInstance().findGlobalSettingValueAsBoolean(GlobalVariable.SHOW_ERROR_LOG_TO_CONSOLE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public void setCustomFieldFilter(String customFieldName, List<String> values) {
}

public long getStatisticChartScalingInterval() {
String statisticChartScalingInterval = new GlobalSettingService().findGlobalSettingValue(GlobalVariable.STATISTIC_CHART_SCALING_INTERVAL);
String statisticChartScalingInterval = GlobalSettingService.getInstance().findGlobalSettingValue(GlobalVariable.STATISTIC_CHART_SCALING_INTERVAL);
return StringUtils.isNotBlank(statisticChartScalingInterval) ? Long.valueOf(statisticChartScalingInterval) : 0;
}

Expand Down
Loading

0 comments on commit b250346

Please sign in to comment.