realmConfigSource.loadConfiguration();
// if Nexus was upgraded and the security version is 2.0.2 we need to update the model
// NOTE: once the security version changes we no longer need this class
boolean changed = false;
Configuration securityRealmConfig = realmConfigSource.getConfiguration();
if (securityRealmConfig.getVersion().equals("2.0.2")) {
// first get the config and upgrade it
upgrader.upgrade(realmConfigSource.getConfiguration());
changed = true;
}
// NEXUS-5049: but this time, we need to perform this _not_ against SecuritySystem API (is still not up)
// but by directly "tampering" with it's configuration(s).
if (!systemConfigManager.isAnonymousAccessEnabled()
&& !StringUtils.isBlank(systemConfigManager.getAnonymousUsername())) {
// get the probably _changed_ one again
securityRealmConfig = realmConfigSource.getConfiguration();
for (CUser user : securityRealmConfig.getUsers()) {
if (StringUtils.equals(systemConfigManager.getAnonymousUsername(), user.getId())) {
user.setStatus(CUser.STATUS_DISABLED);
changed = true;
break;
}