mirror of https://github.com/apache/archiva.git
[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:
parent
c63b642e69
commit
fa31d5bba5
|
@ -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>
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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,6 +241,7 @@ public class ArchivaAdministrationTest
|
|||
assertTrue( ui.isDisableEasterEggs() );
|
||||
assertFalse( ui.isAppletFindEnabled() );
|
||||
assertFalse( ui.isShowFindArtifacts() );
|
||||
assertTrue( ui.isDisableRegistration() );
|
||||
|
||||
archivaAdministration.updateUiConfiguration( oldUi );
|
||||
}
|
||||
|
|
|
@ -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() );
|
||||
|
|
Loading…
Reference in New Issue