little changes
This commit is contained in:
parent
02b74616b2
commit
1271f9cf43
|
@ -141,7 +141,9 @@ public class AdminController extends AbstractDnetController {
|
||||||
public SystemConfiguration saveSysConf(@RequestBody final SystemConfiguration sysConf, final Authentication authentication) {
|
public SystemConfiguration saveSysConf(@RequestBody final SystemConfiguration sysConf, final Authentication authentication) {
|
||||||
if (UserInfo.isSuperAdmin(authentication)) {
|
if (UserInfo.isSuperAdmin(authentication)) {
|
||||||
sysConf.setId(SystemConfiguration.DEFAULT_ID);
|
sysConf.setId(SystemConfiguration.DEFAULT_ID);
|
||||||
return systemConfigurationRepository.save(sysConf);
|
systemConfigurationRepository.save(sysConf);
|
||||||
|
mailDispatcher.configure(sysConf);
|
||||||
|
return sysConf;
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("User not authorized");
|
throw new RuntimeException("User not authorized");
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class UserInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOrganization(final OidcUser user) {
|
public static String getOrganization(final OidcUser user) {
|
||||||
return user.getAttribute("organization");
|
return StringUtils.firstNonBlank(user.getAttribute("organization"), user.getAttribute("affiliation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,11 @@ public class MailDispatcher {
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
|
||||||
final SystemConfiguration conf = systemConfigurationRepository.findById(SystemConfiguration.DEFAULT_ID).get();
|
final SystemConfiguration conf = systemConfigurationRepository.findById(SystemConfiguration.DEFAULT_ID).get();
|
||||||
|
configure(conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void configure(final SystemConfiguration conf) {
|
||||||
this.enabled = conf.getSmtpEnabled();
|
this.enabled = conf.getSmtpEnabled();
|
||||||
this.fromMail = conf.getSmtpFromMail();
|
this.fromMail = conf.getSmtpFromMail();
|
||||||
this.fromName = conf.getSmtpFromName();
|
this.fromName = conf.getSmtpFromName();
|
||||||
|
|
Loading…
Reference in New Issue