diff options
author | Olivier Lamy <olamy@apache.org> | 2012-09-14 09:27:56 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-09-14 09:27:56 +0000 |
commit | fa31d5bba58d7c0268ea59e63181cfc688da15f4 (patch) | |
tree | 188a95e9e53c777b04d2d41c6e3d69bb2c73d79e /archiva-modules | |
parent | c63b642e6914bf5f564719e4d75bcc77ad526caf (diff) | |
download | archiva-fa31d5bba58d7c0268ea59e63181cfc688da15f4.tar.gz archiva-fa31d5bba58d7c0268ea59e63181cfc688da15f4.zip |
[MRM-918] Switch for disabling user registration.
implements backend part.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1384695 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
4 files changed, 29 insertions, 1 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index 8692e7c50..bcc007dd0 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -1324,6 +1324,12 @@ <version>1.4.0+</version> <type>String</type> </field> + <field> + <name>disableRegistration</name> + <version>1.4.0+</version> + <type>boolean</type> + <defaultValue>false</defaultValue> + </field> </fields> </class> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/UiConfiguration.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/UiConfiguration.java index a2c00e49f..aa3d13fda 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/UiConfiguration.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/UiConfiguration.java @@ -47,6 +47,11 @@ public class UiConfiguration */ private String applicationUrl; + /** + * @since 1.4-M3 + */ + private boolean disableRegistration = false; + public UiConfiguration() { // noop @@ -92,6 +97,16 @@ public class UiConfiguration this.applicationUrl = applicationUrl; } + public boolean isDisableRegistration() + { + return disableRegistration; + } + + public void setDisableRegistration( boolean disableRegistration ) + { + this.disableRegistration = disableRegistration; + } + @Override public String toString() { @@ -101,6 +116,7 @@ public class UiConfiguration sb.append( ", appletFindEnabled=" ).append( appletFindEnabled ); sb.append( ", disableEasterEggs=" ).append( disableEasterEggs ); sb.append( ", applicationUrl='" ).append( applicationUrl ).append( '\'' ); + sb.append( ", disableRegistration=" ).append( disableRegistration ); sb.append( '}' ); return sb.toString(); } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java index f971c792e..5abd7a6fa 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java @@ -226,11 +226,13 @@ public class ArchivaAdministrationTest assertFalse( oldUi.isDisableEasterEggs() ); assertTrue( oldUi.isAppletFindEnabled() ); assertTrue( oldUi.isShowFindArtifacts() ); + assertFalse( oldUi.isDisableRegistration() ); UiConfiguration ui = archivaAdministration.getUiConfiguration(); ui.setAppletFindEnabled( false ); ui.setShowFindArtifacts( false ); ui.setDisableEasterEggs( true ); + ui.setDisableRegistration( true ); archivaAdministration.updateUiConfiguration( ui ); @@ -239,7 +241,8 @@ public class ArchivaAdministrationTest assertTrue( ui.isDisableEasterEggs() ); assertFalse( ui.isAppletFindEnabled() ); assertFalse( ui.isShowFindArtifacts() ); - + assertTrue( ui.isDisableRegistration() ); + archivaAdministration.updateUiConfiguration( oldUi ); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java index ddf1fac03..9c9e18653 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ArchivaAdministrationServiceTest.java @@ -117,6 +117,7 @@ public class ArchivaAdministrationServiceTest assertNotNull( ui ); // assert default values assertFalse( ui.isDisableEasterEggs() ); + assertFalse( ui.isDisableRegistration() ); assertTrue( ui.isAppletFindEnabled() ); assertTrue( ui.isShowFindArtifacts() ); assertNull( ui.getApplicationUrl() ); @@ -124,6 +125,7 @@ public class ArchivaAdministrationServiceTest ui.setAppletFindEnabled( false ); ui.setShowFindArtifacts( false ); ui.setDisableEasterEggs( true ); + ui.setDisableRegistration( true ); String url = "http://foo.fr/bar"; ui.setApplicationUrl( url ); @@ -132,6 +134,7 @@ public class ArchivaAdministrationServiceTest ui = getArchivaAdministrationService().getUiConfiguration(); assertTrue( ui.isDisableEasterEggs() ); + assertTrue( ui.isDisableRegistration() ); assertFalse( ui.isAppletFindEnabled() ); assertFalse( ui.isShowFindArtifacts() ); assertEquals( url, ui.getApplicationUrl() ); |