Fixing tenant loading problem

4.x.x
Megala 8 years ago
parent e8eb0123c7
commit 359bd8f317

@ -35,11 +35,6 @@ var onFail;
if (!context.input.samlToken) { if (!context.input.samlToken) {
(new carbonServer.Server({url: devicemgtProps["adminService"]})) (new carbonServer.Server({url: devicemgtProps["adminService"]}))
.login(context.input.username, context.input.password); .login(context.input.username, context.input.password);
} else {
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;
PrivilegedCarbonContext.startTenantFlow();
var cxt = PrivilegedCarbonContext.getThreadLocalCarbonContext();
cxt.setTenantDomain(context.user.domain, true);
} }
}; };

@ -532,8 +532,8 @@ var module = {};
if (ssoSession.sessionId) { if (ssoSession.sessionId) {
var ssoSessions = getSsoSessions(); var ssoSessions = getSsoSessions();
ssoSessions[ssoSession.sessionId] = ssoSession; ssoSessions[ssoSession.sessionId] = ssoSession;
if (ssoSessions.sessionIndex != null || ssoSessions.sessionIndex != 'undefined') { if (ssoSession.sessionIndex != null || ssoSession.sessionIndex != 'undefined') {
module.loadTenant(ssoSessions.loggedInUser); module.loadTenant(ssoSession.loggedInUser);
var carbonUser = (require("carbon")).server.tenantUser(ssoSession.loggedInUser); var carbonUser = (require("carbon")).server.tenantUser(ssoSession.loggedInUser);
utils.setCurrentUser(carbonUser.username, carbonUser.domain, carbonUser.tenantId); utils.setCurrentUser(carbonUser.username, carbonUser.domain, carbonUser.tenantId);
var scriptArgument = {input: {samlToken: ssoSession.samlToken}, user: module.getCurrentUser()}; var scriptArgument = {input: {samlToken: ssoSession.samlToken}, user: module.getCurrentUser()};

Loading…
Cancel
Save