Skip to content

Commit

Permalink
Remove indexing page and Index Must Be Updated Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Mar 7, 2024
1 parent b043289 commit 2f44cb8
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -726,15 +726,6 @@ public boolean hasAuthorityToViewSystemPage() {
|| securityAccessService.hasAuthorityToViewMigrationPage();
}

/**
* Check if current user has authority to view index page.
*
* @return true if user has authority to 'viewIndex' page.
*/
public boolean hasAuthorityToViewIndexPage() {
return securityAccessService.hasAuthorityToViewIndexPage();
}

/**
* Check if current user has authority to view task manager page.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,7 @@ public ObjectType getNoneType() {
* Update the view.
*/
public void updateView() {
try {
if (ServiceManager.getIndexingService().isIndexCorrupted()) {
Helper.setErrorMessage("indexOutOfDate");
}
Ajax.update("@all");
} catch (DataException | DAOException e) {
Helper.setErrorMessage(e.getMessage());
}
Ajax.update("@all");
}

/**
Expand Down
18 changes: 1 addition & 17 deletions Kitodo/src/main/java/org/kitodo/production/forms/LoginForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,16 @@ public void performPostLoginChecks() throws DataException, DAOException, IOExcep

ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
SessionClientController controller = new SessionClientController();
PrimeFaces.current().executeScript("PF('indexWarningDialog').hide();");

if (ServiceManager.getSecurityAccessService().hasAuthorityToEditIndex()) {
if (controller.getAvailableClientsOfCurrentUser().size() > 1
&& Objects.isNull(controller.getCurrentSessionClient())) {
controller.showClientSelectDialog();
} else if (ServiceManager.getIndexingService().isIndexCorrupted()) {
context.redirect(INDEXING_PAGE + determineIndexingTab());
} else {
redirect(context);
}
} else {
if (ServiceManager.getIndexingService().isIndexCorrupted()) {
PrimeFaces.current().executeScript("PF('indexWarningDialog').show();");
} else if (controller.getAvailableClientsOfCurrentUser().size() > 1
if (controller.getAvailableClientsOfCurrentUser().size() > 1
&& Objects.isNull(controller.getCurrentSessionClient())) {
controller.showClientSelectDialog();
} else {
Expand All @@ -131,15 +126,4 @@ private void redirect(ExternalContext context) throws IOException {
context.redirect(context.getRequestContextPath() + originalRequest);
}
}

private int determineIndexingTab() {
int indexingTabIndex = 2;
if (!securityAccessService.hasAuthorityToViewTermsPage()) {
indexingTabIndex -= 1;
}
if (!securityAccessService.hasAuthorityToViewTaskManagerPage()) {
indexingTabIndex -= 1;
}
return indexingTabIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,17 @@ public class CustomLoginSuccessHandler implements AuthenticationSuccessHandler {
public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
Authentication authentication) throws IOException {

try {
SessionClientController controller = new SessionClientController();
if (ServiceManager.getIndexingService().isIndexCorrupted()
|| controller.getAvailableClientsOfCurrentUser().size() > 1) {
// redirect to empty landing page, where dialogs are displayed depending on both checks!
redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, EMPTY_LANDING_PAGE);
} else {
if (Objects.nonNull(httpServletRequest.getSession())) {
// calling showClientSelectDialog automatically sets the only one available client here
controller.showClientSelectDialog();
redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse,
getOriginalRequest(httpServletRequest.getSession().getAttribute(SAVED_REQUEST)));
}
SessionClientController controller = new SessionClientController();
if (controller.getAvailableClientsOfCurrentUser().size() > 1) {
// redirect to empty landing page, where dialogs are displayed depending on both checks!
redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, EMPTY_LANDING_PAGE);
} else {
if (Objects.nonNull(httpServletRequest.getSession())) {
// calling showClientSelectDialog automatically sets the only one available client here
controller.showClientSelectDialog();
redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse,
getOriginalRequest(httpServletRequest.getSession().getAttribute(SAVED_REQUEST)));
}
} catch (DataException | DAOException e) {
logger.error(e.getLocalizedMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ public Map<ObjectType, Integer> getCountDatabaseObjects() {
return countDatabaseObjects;
}

public boolean isIndexCorrupted() throws DAOException, DataException {
updateCounts();
return getTotalCount() != getAllIndexed();
}

/**
* Return the number of all objects processed during the current indexing
* progress.
Expand Down
7 changes: 0 additions & 7 deletions Kitodo/src/main/resources/messages/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ imprint=Impressum
imprintDefaultText=Das Impressum f\u00FCr dieses System wurde noch nicht hinterlegt.
indexedEntries=Indexierte Eintr\u00E4ge
indexing=Indexierung
indexOutOfDate=Der Index muss aktualisiert werden!
insert=Einf\u00FCgen
insertAsUncounted=Als unnummeriert einf\u00FCgen
insertHere=hier einf\u00FCgen
Expand Down Expand Up @@ -1093,12 +1092,6 @@ structuralElement=Strukturelement
structureElementAdd=Strukturelement hinzuf\u00FCgen
structureElementDelete=Strukturelement l\u00F6schen
system=System
systemComeBackLaterMessage=Bitte versuchen Sie es sp\u00E4ter erneut!
systemErrorHeader=Systemfehler
systemErrorInformAdminMessage=Bitte informieren Sie einen Administrator!
systemErrorMessage=Es ist ein Fehler im System aufgetreten.
systemMaintenanceHeader=Systemwartung
systemMaintenanceMessage=Das System wird derzeit gewartet.
table=Tabelle
tableSize=Tabellengr\u00F6\u00DFe
task=Aufgabe
Expand Down
7 changes: 0 additions & 7 deletions Kitodo/src/main/resources/messages/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ imprint=Imprint
imprintDefaultText=Imprint information have not been configured for this system.
indexedEntries=Indexed entries
indexing=Indexing
indexOutOfDate=The search index needs to be updated!
insert=Insert
insertAsUncounted=Insert as uncounted
insertHere=insert here
Expand Down Expand Up @@ -1094,12 +1093,6 @@ structuralElement=Structural element
structureElementAdd=Add docstruct
structureElementDelete=Delete docstruct
system=System
systemComeBackLaterMessage=Please try again later!
systemErrorHeader=System error
systemErrorInformAdminMessage=Please inform an administrator!
systemErrorMessage=A system error occurred.
systemMaintenanceHeader=System maintenance
systemMaintenanceMessage=The system is currently under maintenance.
table=Table
tableSize=Table size
task=Task
Expand Down
7 changes: 0 additions & 7 deletions Kitodo/src/main/resources/messages/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ imprint=Pie de imprenta
imprintDefaultText=La huella de este sistema aún no se ha almacenado.
indexedEntries=Entradas indexadas
indexing=Indexación
indexOutOfDate=Hay que actualizar el índice.
insert=Insertar
insertAsUncounted=Insertar como no numerado
insertHere=Insertar aquí
Expand Down Expand Up @@ -1079,12 +1078,6 @@ structuralElement=Elemento de la estructura
structureElementAdd=Añadir elemento estructural
structureElementDelete=Borrar el elemento estructural
system=Sistema
systemComeBackLaterMessage=Por favor, inténtelo más tarde.
systemErrorHeader=Error del sistema
systemErrorInformAdminMessage=Por favor, informe a un administrador.
systemErrorMessage=Se ha producido un error en el sistema.
systemMaintenanceHeader=Mantenimiento del sistema
systemMaintenanceMessage=El sistema se encuentra actualmente en fase de mantenimiento.
table=Tabla
tableSize=Tamaño de la tabla
task=Tarea
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion Kitodo/src/main/webapp/pages/checks.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<ui:define name="content" />

<ui:define name="dialog">
<ui:include src="/WEB-INF/templates/includes/base/indexWarningDialog.xhtml"/>
<ui:include src="/WEB-INF/templates/includes/base/selectClientDialog.xhtml"/>
</ui:define>

Expand Down
4 changes: 0 additions & 4 deletions Kitodo/src/main/webapp/pages/system.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
rendered="#{SecurityAccessController.hasAuthorityToViewTermsPage()}">
<ui:include src="/WEB-INF/templates/includes/system/legalTextEditor.xhtml" />
</p:tab>
<p:tab id="indexingTab" title="#{msgs.indexing}"
rendered="#{SecurityAccessController.hasAuthorityToViewIndexPage()}">
<ui:include src="/WEB-INF/templates/includes/system/indexing.xhtml" />
</p:tab>
<p:tab id="migrationTab" title="#{msgs.migration}"
rendered="#{SecurityAccessController.hasAuthorityToViewMigrationPage()}">
<ui:include src="/WEB-INF/templates/includes/system/migration.xhtml" />
Expand Down

0 comments on commit 2f44cb8

Please sign in to comment.