mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
[modularisation fixes] login and workspaces (#12139)
* Fixed the organization invite issue for existed users after unarchive * Fixed workspace switching issue
This commit is contained in:
parent
5fd9711f8e
commit
0fa90ee875
3 changed files with 4 additions and 3 deletions
|
|
@ -226,7 +226,7 @@ export const authorizeUserAndHandleErrors = (workspace_id, workspace_slug, callb
|
|||
const unauthorized_organization_slug = workspace_slug;
|
||||
|
||||
/* get current session's workspace id */
|
||||
authenticationService
|
||||
sessionService
|
||||
.validateSession()
|
||||
.then(({ current_organization_id, ...restSessionData }) => {
|
||||
/* change current organization id to valid one [current logged in organization] */
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@ export class AllowPersonalWorkspaceGuard implements CanActivate {
|
|||
async canActivate(context: ExecutionContext): Promise<boolean> {
|
||||
const request = context.switchToHttp().getRequest();
|
||||
const user = request.user;
|
||||
const organizationId = request.body.organizationId;
|
||||
|
||||
const isPersonalWorkspaceEnabled =
|
||||
(await this.instanceSettingsUtilService.getSettings(INSTANCE_USER_SETTINGS.ALLOW_PERSONAL_WORKSPACE)) === 'true';
|
||||
|
||||
return isSuperAdmin(user) || isPersonalWorkspaceEnabled;
|
||||
return isSuperAdmin(user) || isPersonalWorkspaceEnabled || !!organizationId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export class InvitedUserSessionAuthGuard extends AuthGuard('jwt') {
|
|||
return invitedUser;
|
||||
}
|
||||
/* User doesn't have a session. Next?: login again and accept invite */
|
||||
const organization = await this.organizationRepository.fetchOrganization(invitedUser.invitedOrganizationId);
|
||||
const organization = await this.organizationRepository.fetchOrganization(invitedUser.organizationId);
|
||||
|
||||
if (!organization || organization.status !== WORKSPACE_STATUS.ACTIVE) {
|
||||
throw new BadRequestException('Organization is Archived');
|
||||
|
|
|
|||
Loading…
Reference in a new issue