diff options
author | Olivier Lamy <olamy@apache.org> | 2023-06-22 16:53:40 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2023-06-22 16:53:40 +1000 |
commit | b8fcef8f78e3bff24cc077f5ad1e98e521a667ad (patch) | |
tree | 709003d2b25bab438ffd7155b32676c2a30fe4c5 | |
parent | c07e1e37efde31fc5fdca6ae76cf3a2885e2f1b1 (diff) | |
download | archiva-b8fcef8f78e3bff24cc077f5ad1e98e521a667ad.tar.gz archiva-b8fcef8f78e3bff24cc077f5ad1e98e521a667ad.zip |
disable registration link should disable registration for realarchiva-2.x
Signed-off-by: Olivier Lamy <olamy@apache.org>
2 files changed, 14 insertions, 3 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java index 3be9f58dd..57d0ce6f6 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java @@ -27,6 +27,7 @@ import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.UserInterfaceOptions; import org.apache.archiva.configuration.WebappConfiguration; import org.apache.archiva.metadata.model.facets.AuditEvent; +import org.apache.archiva.redback.configuration.UserConfiguration; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; @@ -60,6 +61,7 @@ public class DefaultArchivaAdministration // setup wagon on start with initial values NetworkConfiguration networkConfiguration = getNetworkConfiguration(); setupWagon( networkConfiguration ); + System.setProperty(UserConfiguration.USER_REGISTRATION_DISABLE_KEY, Boolean.toString(getUiConfiguration().isDisableRegistration())); } @PreDestroy @@ -389,7 +391,6 @@ public class DefaultArchivaAdministration Configuration configuration = getArchivaConfiguration().getConfiguration(); if ( uiConfiguration != null ) { - UserInterfaceOptions userInterfaceOptions = getModelMapper().map( uiConfiguration, UserInterfaceOptions.class ); configuration.getWebapp().setUi( userInterfaceOptions ); @@ -398,6 +399,15 @@ public class DefaultArchivaAdministration { configuration.getWebapp().setUi( null ); } + + if( uiConfiguration != null && uiConfiguration.isDisableRegistration() ) + { + System.setProperty(UserConfiguration.USER_REGISTRATION_DISABLE_KEY, Boolean.TRUE.toString()); + } + if( uiConfiguration != null && !uiConfiguration.isDisableRegistration() ) + { + System.setProperty(UserConfiguration.USER_REGISTRATION_DISABLE_KEY, Boolean.FALSE.toString()); + } saveConfiguration( configuration ); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java index 51144e87a..295c85227 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java @@ -269,7 +269,7 @@ public class DefaultArchivaAdministrationService { try { - return new ArrayList<String>( archivaAdministration.getKnownContentConsumers() ); + return new ArrayList<>( archivaAdministration.getKnownContentConsumers() ); } catch ( RepositoryAdminException e ) { @@ -283,7 +283,7 @@ public class DefaultArchivaAdministrationService { try { - return new ArrayList<String>( archivaAdministration.getInvalidContentConsumers() ); + return new ArrayList<>( archivaAdministration.getInvalidContentConsumers() ); } catch ( RepositoryAdminException e ) { @@ -351,6 +351,7 @@ public class DefaultArchivaAdministrationService uiConfiguration.setApplicationUrl(StringUtils.stripEnd(uiConfiguration.getApplicationUrl(), "/")); archivaAdministration.updateUiConfiguration( uiConfiguration ); + } catch ( RepositoryAdminException e ) { |