mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
Add fallback mail host to global config
This commit is contained in:
@@ -80,6 +80,12 @@ public class ScmConfiguration implements Configuration {
|
|||||||
*/
|
*/
|
||||||
public static final String DEFAULT_LOGIN_INFO_URL = "https://login-info.scm-manager.org/api/v1/login-info";
|
public static final String DEFAULT_LOGIN_INFO_URL = "https://login-info.scm-manager.org/api/v1/login-info";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default e-mail host that will be used whenever we have to generate an e-mail address for a user that has no mail
|
||||||
|
* address configured.
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_MAIL_HOST = "scm-manager.local";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default plugin url from version 1.0
|
* Default plugin url from version 1.0
|
||||||
*/
|
*/
|
||||||
@@ -187,6 +193,8 @@ public class ScmConfiguration implements Configuration {
|
|||||||
@XmlElement(name = "login-info-url")
|
@XmlElement(name = "login-info-url")
|
||||||
private String loginInfoUrl = DEFAULT_LOGIN_INFO_URL;
|
private String loginInfoUrl = DEFAULT_LOGIN_INFO_URL;
|
||||||
|
|
||||||
|
@XmlElement(name = "mail-host")
|
||||||
|
private String mailHost = DEFAULT_MAIL_HOST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the {@link sonia.scm.ConfigChangedListener#configChanged(Object)}
|
* Calls the {@link sonia.scm.ConfigChangedListener#configChanged(Object)}
|
||||||
@@ -227,6 +235,7 @@ public class ScmConfiguration implements Configuration {
|
|||||||
this.namespaceStrategy = other.namespaceStrategy;
|
this.namespaceStrategy = other.namespaceStrategy;
|
||||||
this.loginInfoUrl = other.loginInfoUrl;
|
this.loginInfoUrl = other.loginInfoUrl;
|
||||||
this.releaseFeedUrl = other.releaseFeedUrl;
|
this.releaseFeedUrl = other.releaseFeedUrl;
|
||||||
|
this.mailHost = other.mailHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,6 +300,15 @@ public class ScmConfiguration implements Configuration {
|
|||||||
return releaseFeedUrl;
|
return releaseFeedUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the mail host, that will be used to create e-mail addresses for users without one whenever one is required.
|
||||||
|
*
|
||||||
|
* @since 2.8.0
|
||||||
|
*/
|
||||||
|
public String getMailHost() {
|
||||||
|
return mailHost;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set of glob patterns for urls which should excluded from
|
* Returns a set of glob patterns for urls which should excluded from
|
||||||
* proxy settings.
|
* proxy settings.
|
||||||
@@ -471,6 +489,16 @@ public class ScmConfiguration implements Configuration {
|
|||||||
this.releaseFeedUrl = releaseFeedUrl;
|
this.releaseFeedUrl = releaseFeedUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the mail host, that will be used to create e-mail addresses for users without one whenever one is required.
|
||||||
|
*
|
||||||
|
* @param mailHost The new mail host to use.
|
||||||
|
* @since 2.8.0
|
||||||
|
*/
|
||||||
|
public void setMailHost(String mailHost) {
|
||||||
|
this.mailHost = mailHost;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set glob patterns for urls which are should be excluded from proxy
|
* Set glob patterns for urls which are should be excluded from proxy
|
||||||
* settings.
|
* settings.
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ export type Config = {
|
|||||||
namespaceStrategy: string;
|
namespaceStrategy: string;
|
||||||
loginInfoUrl: string;
|
loginInfoUrl: string;
|
||||||
releaseFeedUrl: string;
|
releaseFeedUrl: string;
|
||||||
|
mailHost: string;
|
||||||
_links: Links;
|
_links: Links;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
"skip-failed-authenticators": "Fehlgeschlagene Authentifizierer überspringen",
|
"skip-failed-authenticators": "Fehlgeschlagene Authentifizierer überspringen",
|
||||||
"plugin-url": "Plugin Center URL",
|
"plugin-url": "Plugin Center URL",
|
||||||
"release-feed-url": "Release Feed URL",
|
"release-feed-url": "Release Feed URL",
|
||||||
|
"mail-host": "Fallback Mail Host",
|
||||||
"enabled-xsrf-protection": "XSRF Protection aktivieren",
|
"enabled-xsrf-protection": "XSRF Protection aktivieren",
|
||||||
"namespace-strategy": "Namespace Strategie",
|
"namespace-strategy": "Namespace Strategie",
|
||||||
"login-info-url": "Login Info URL"
|
"login-info-url": "Login Info URL"
|
||||||
@@ -62,6 +63,7 @@
|
|||||||
"dateFormatHelpText": "Moments Datumsformat. Zulässige Formate sind in der MomentJS Dokumentation beschrieben.",
|
"dateFormatHelpText": "Moments Datumsformat. Zulässige Formate sind in der MomentJS Dokumentation beschrieben.",
|
||||||
"pluginUrlHelpText": "Die URL der Plugin Center API. Beschreibung der Platzhalter: version = SCM-Manager Version; os = Betriebssystem; arch = Architektur",
|
"pluginUrlHelpText": "Die URL der Plugin Center API. Beschreibung der Platzhalter: version = SCM-Manager Version; os = Betriebssystem; arch = Architektur",
|
||||||
"releaseFeedUrlHelpText": "Die URL des RSS Release Feed des SCM-Manager. Darüber wird über die neue SCM-Manager Version informiert. Um diese Funktion zu deaktivieren lassen Sie dieses Feld leer.",
|
"releaseFeedUrlHelpText": "Die URL des RSS Release Feed des SCM-Manager. Darüber wird über die neue SCM-Manager Version informiert. Um diese Funktion zu deaktivieren lassen Sie dieses Feld leer.",
|
||||||
|
"mailHostHelpText": "Dieser Host Name wird genutzt, wenn für einen User eine E-Mail-Adresse benötigt wird, für den keine hinterlegt ist. Dieser Host wird nicht zum Versenden von E-Mails genutzt und auch keine anderweitige Verbindung aufgebaut.",
|
||||||
"enableForwardingHelpText": "mod_proxy Port Weiterleitung aktivieren.",
|
"enableForwardingHelpText": "mod_proxy Port Weiterleitung aktivieren.",
|
||||||
"disableGroupingGridHelpText": "Repository Gruppen deaktivieren. Nach einer Änderung an dieser Einstellung muss die Seite komplett neu geladen werden.",
|
"disableGroupingGridHelpText": "Repository Gruppen deaktivieren. Nach einer Änderung an dieser Einstellung muss die Seite komplett neu geladen werden.",
|
||||||
"allowAnonymousAccessHelpText": "Anonyme Benutzer haben Zugriff auf freigegebene Repositories.",
|
"allowAnonymousAccessHelpText": "Anonyme Benutzer haben Zugriff auf freigegebene Repositories.",
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
"skip-failed-authenticators": "Skip Failed Authenticators",
|
"skip-failed-authenticators": "Skip Failed Authenticators",
|
||||||
"plugin-url": "Plugin Center URL",
|
"plugin-url": "Plugin Center URL",
|
||||||
"release-feed-url": "Release Feed URL",
|
"release-feed-url": "Release Feed URL",
|
||||||
|
"mail-host": "Fallback Mail Host",
|
||||||
"enabled-xsrf-protection": "Enabled XSRF Protection",
|
"enabled-xsrf-protection": "Enabled XSRF Protection",
|
||||||
"namespace-strategy": "Namespace Strategy",
|
"namespace-strategy": "Namespace Strategy",
|
||||||
"login-info-url": "Login Info URL"
|
"login-info-url": "Login Info URL"
|
||||||
@@ -62,6 +63,7 @@
|
|||||||
"dateFormatHelpText": "Moments date format. Please have a look at the MomentJS documentation.",
|
"dateFormatHelpText": "Moments date format. Please have a look at the MomentJS documentation.",
|
||||||
"pluginUrlHelpText": "The url of the Plugin Center API. Explanation of the placeholders: version = SCM-Manager Version; os = Operation System; arch = Architecture",
|
"pluginUrlHelpText": "The url of the Plugin Center API. Explanation of the placeholders: version = SCM-Manager Version; os = Operation System; arch = Architecture",
|
||||||
"releaseFeedUrlHelpText": "The url of the RSS Release Feed for SCM-Manager. This provides up-to-date version information. To disable this feature just leave the url blank.",
|
"releaseFeedUrlHelpText": "The url of the RSS Release Feed for SCM-Manager. This provides up-to-date version information. To disable this feature just leave the url blank.",
|
||||||
|
"mailHostHelpText": "This host name will be used to create email addresses for users when needed and they have none configured. It will not be used to send mails nor will be accessed otherwise.",
|
||||||
"enableForwardingHelpText": "Enable mod_proxy port forwarding.",
|
"enableForwardingHelpText": "Enable mod_proxy port forwarding.",
|
||||||
"disableGroupingGridHelpText": "Disable repository Groups. A complete page reload is required after a change of this value.",
|
"disableGroupingGridHelpText": "Disable repository Groups. A complete page reload is required after a change of this value.",
|
||||||
"allowAnonymousAccessHelpText": "Anonymous users have access on granted repositories.",
|
"allowAnonymousAccessHelpText": "Anonymous users have access on granted repositories.",
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ class ConfigForm extends React.Component<Props, State> {
|
|||||||
skipFailedAuthenticators={config.skipFailedAuthenticators}
|
skipFailedAuthenticators={config.skipFailedAuthenticators}
|
||||||
pluginUrl={config.pluginUrl}
|
pluginUrl={config.pluginUrl}
|
||||||
releaseFeedUrl={config.releaseFeedUrl}
|
releaseFeedUrl={config.releaseFeedUrl}
|
||||||
|
mailHost={config.mailHost}
|
||||||
enabledXsrfProtection={config.enabledXsrfProtection}
|
enabledXsrfProtection={config.enabledXsrfProtection}
|
||||||
namespaceStrategy={config.namespaceStrategy}
|
namespaceStrategy={config.namespaceStrategy}
|
||||||
onChange={(isValid, changedValue, name) => this.onChange(isValid, changedValue, name)}
|
onChange={(isValid, changedValue, name) => this.onChange(isValid, changedValue, name)}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ type Props = WithTranslation & {
|
|||||||
skipFailedAuthenticators: boolean;
|
skipFailedAuthenticators: boolean;
|
||||||
pluginUrl: string;
|
pluginUrl: string;
|
||||||
releaseFeedUrl: string;
|
releaseFeedUrl: string;
|
||||||
|
mailHost: string;
|
||||||
enabledXsrfProtection: boolean;
|
enabledXsrfProtection: boolean;
|
||||||
namespaceStrategy: string;
|
namespaceStrategy: string;
|
||||||
namespaceStrategies?: NamespaceStrategies;
|
namespaceStrategies?: NamespaceStrategies;
|
||||||
@@ -51,6 +52,7 @@ class GeneralSettings extends React.Component<Props> {
|
|||||||
loginInfoUrl,
|
loginInfoUrl,
|
||||||
pluginUrl,
|
pluginUrl,
|
||||||
releaseFeedUrl,
|
releaseFeedUrl,
|
||||||
|
mailHost,
|
||||||
enabledXsrfProtection,
|
enabledXsrfProtection,
|
||||||
anonymousMode,
|
anonymousMode,
|
||||||
namespaceStrategy,
|
namespaceStrategy,
|
||||||
@@ -129,7 +131,7 @@ class GeneralSettings extends React.Component<Props> {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column">
|
<div className="column is-half">
|
||||||
<InputField
|
<InputField
|
||||||
label={t("general-settings.release-feed-url")}
|
label={t("general-settings.release-feed-url")}
|
||||||
onChange={this.handleReleaseFeedUrlChange}
|
onChange={this.handleReleaseFeedUrlChange}
|
||||||
@@ -138,6 +140,15 @@ class GeneralSettings extends React.Component<Props> {
|
|||||||
helpText={t("help.releaseFeedUrlHelpText")}
|
helpText={t("help.releaseFeedUrlHelpText")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="column is-half">
|
||||||
|
<InputField
|
||||||
|
label={t("general-settings.mail-host")}
|
||||||
|
onChange={this.handleMailHostChange}
|
||||||
|
value={mailHost}
|
||||||
|
disabled={!hasUpdatePermission}
|
||||||
|
helpText={t("help.mailHostHelpText")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -164,6 +175,9 @@ class GeneralSettings extends React.Component<Props> {
|
|||||||
handleReleaseFeedUrlChange = (value: string) => {
|
handleReleaseFeedUrlChange = (value: string) => {
|
||||||
this.props.onChange(true, value, "releaseFeedUrl");
|
this.props.onChange(true, value, "releaseFeedUrl");
|
||||||
};
|
};
|
||||||
|
handleMailHostChange = (value: string) => {
|
||||||
|
this.props.onChange(true, value, "mailHost");
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withTranslation("config")(GeneralSettings);
|
export default withTranslation("config")(GeneralSettings);
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class ConfigDto extends HalRepresentation {
|
|||||||
private String namespaceStrategy;
|
private String namespaceStrategy;
|
||||||
private String loginInfoUrl;
|
private String loginInfoUrl;
|
||||||
private String releaseFeedUrl;
|
private String releaseFeedUrl;
|
||||||
|
private String mailHost;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("squid:S1185") // We want to have this method available in this package
|
@SuppressWarnings("squid:S1185") // We want to have this method available in this package
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public class ConfigDtoToScmConfigurationMapperTest {
|
|||||||
assertTrue(config.isEnabledXsrfProtection());
|
assertTrue(config.isEnabledXsrfProtection());
|
||||||
assertEquals("username", config.getNamespaceStrategy());
|
assertEquals("username", config.getNamespaceStrategy());
|
||||||
assertEquals("https://scm-manager.org/login-info", config.getLoginInfoUrl());
|
assertEquals("https://scm-manager.org/login-info", config.getLoginInfoUrl());
|
||||||
|
assertEquals("hitchhiker.mail", config.getMailHost());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -113,6 +114,7 @@ public class ConfigDtoToScmConfigurationMapperTest {
|
|||||||
configDto.setEnabledXsrfProtection(true);
|
configDto.setEnabledXsrfProtection(true);
|
||||||
configDto.setNamespaceStrategy("username");
|
configDto.setNamespaceStrategy("username");
|
||||||
configDto.setLoginInfoUrl("https://scm-manager.org/login-info");
|
configDto.setLoginInfoUrl("https://scm-manager.org/login-info");
|
||||||
|
configDto.setMailHost("hitchhiker.mail");
|
||||||
|
|
||||||
return configDto;
|
return configDto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ public class ScmConfigurationToConfigDtoMapperTest {
|
|||||||
assertEquals("username", dto.getNamespaceStrategy());
|
assertEquals("username", dto.getNamespaceStrategy());
|
||||||
assertEquals("https://scm-manager.org/login-info", dto.getLoginInfoUrl());
|
assertEquals("https://scm-manager.org/login-info", dto.getLoginInfoUrl());
|
||||||
assertEquals("https://www.scm-manager.org/download/rss.xml", dto.getReleaseFeedUrl());
|
assertEquals("https://www.scm-manager.org/download/rss.xml", dto.getReleaseFeedUrl());
|
||||||
|
assertEquals("scm-manager.local", dto.getMailHost());
|
||||||
|
|
||||||
assertEquals(expectedBaseUri.toString(), dto.getLinks().getLinkBy("self").get().getHref());
|
assertEquals(expectedBaseUri.toString(), dto.getLinks().getLinkBy("self").get().getHref());
|
||||||
assertEquals(expectedBaseUri.toString(), dto.getLinks().getLinkBy("update").get().getHref());
|
assertEquals(expectedBaseUri.toString(), dto.getLinks().getLinkBy("update").get().getHref());
|
||||||
|
|||||||
Reference in New Issue
Block a user