[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:
Muhsin Shah C P 2025-03-07 11:33:59 +05:30 committed by GitHub
parent 5fd9711f8e
commit 0fa90ee875
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -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] */

View file

@ -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;
}
}

View file

@ -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');