CB-1908 user flow fixes

This commit is contained in:
Alexander Skoblikov
2022-04-22 14:52:50 +03:00
parent 12228c2d10
commit a85d2c5b2a
3 changed files with 7 additions and 6 deletions
@@ -890,7 +890,7 @@ public class WebSession extends AbstractSessionPersistent implements SMSession,
this.sessionPermissions = null;
this.smCredentials = null;
this.user = null;
this.securityController = application.getSecurityController(null);
this.securityController = application.getSecurityController(this);
this.adminSecurityController = null;
}
@@ -77,7 +77,7 @@ public class WebServiceAuthImpl implements DBWServiceAuth {
// Check enabled auth providers
boolean providerEnabled = isProviderEnabled(providerId, authProvider);
boolean resetUserStateOnError = webSession.getUser() != null;
boolean resetUserStateOnError = webSession.getUser() == null;
try {
Map<String, Object> providerConfig = Collections.emptyMap();
@@ -849,11 +849,12 @@ public class CBSecurityController implements SMAdminController<WebUser, WebRole>
if (!isSubjectExists(userId)) {
var newUser = new WebUser(userId);
createUser(newUser.getUserId(), newUser.getMetaParameters());
String defaultRoleName = WebAppUtils.getWebApplication().getAppConfiguration().getDefaultUserRole();
if (!CommonUtils.isEmpty(defaultRoleName)) {
setUserRoles(userId, new String[]{defaultRoleName}, userId);
}
}
String defaultRoleName = WebAppUtils.getWebApplication().getAppConfiguration().getDefaultUserRole();
if (!CommonUtils.isEmpty(defaultRoleName)) {
setUserRoles(userId, new String[]{defaultRoleName}, userId);
}
setUserCredentials(userId, authProviderId, userCredentials);
return userId;