little changes

This commit is contained in:
Michele Artini 2022-09-23 08:22:00 +02:00
parent 02b74616b2
commit 1271f9cf43
3 changed files with 7 additions and 3 deletions

View File

@ -141,7 +141,9 @@ public class AdminController extends AbstractDnetController {
public SystemConfiguration saveSysConf(@RequestBody final SystemConfiguration sysConf, final Authentication authentication) {
if (UserInfo.isSuperAdmin(authentication)) {
sysConf.setId(SystemConfiguration.DEFAULT_ID);
return systemConfigurationRepository.save(sysConf);
systemConfigurationRepository.save(sysConf);
mailDispatcher.configure(sysConf);
return sysConf;
} else {
throw new RuntimeException("User not authorized");
}

View File

@ -113,7 +113,7 @@ public class UserInfo {
}
public static String getOrganization(final OidcUser user) {
return user.getAttribute("organization");
return StringUtils.firstNonBlank(user.getAttribute("organization"), user.getAttribute("affiliation"));
}
}

View File

@ -37,9 +37,11 @@ public class MailDispatcher {
@PostConstruct
public void configure() {
final SystemConfiguration conf = systemConfigurationRepository.findById(SystemConfiguration.DEFAULT_ID).get();
configure(conf);
}
public void configure(final SystemConfiguration conf) {
this.enabled = conf.getSmtpEnabled();
this.fromMail = conf.getSmtpFromMail();
this.fromName = conf.getSmtpFromName();