[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
This commit is contained in:
Olivier Lamy 2012-09-14 09:27:56 +00:00
parent c63b642e69
commit fa31d5bba5
5 changed files with 30 additions and 1 deletions

View File

@ -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>

View File

@ -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();
}

View File

@ -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 );
}

View File

@ -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() );

View File

@ -1828,6 +1828,7 @@
<exclude>.idea/**</exclude>
<exclude>.repository/**</exclude>
<exclude>*.patch</exclude>
<exclude>**/target/**</exclude>
</excludes>
</configuration>
</plugin>