mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Fix tests
Signed-off-by: Anton Alexeyev <alexeyev.anton@gmail.com>
This commit is contained in:
parent
376e4bce71
commit
57122b2f75
@ -598,6 +598,7 @@ describe('PostgresAccountDB', () => {
|
||||
uuid: workspaceId,
|
||||
name: 'Test',
|
||||
url: 'test',
|
||||
allowReadOnlyGuest: false,
|
||||
createdOn: 1234567890000,
|
||||
status: {
|
||||
mode: 'active',
|
||||
|
@ -1098,6 +1098,7 @@ describe('account utils', () => {
|
||||
const mockWorkspace = {
|
||||
uuid: 'workspace-uuid' as WorkspaceUuid,
|
||||
url: workspaceUrl,
|
||||
allowReadOnlyGuest: false,
|
||||
region: 'us',
|
||||
dataId: 'test-data-id'
|
||||
}
|
||||
|
@ -565,6 +565,7 @@ export async function selectWorkspace (
|
||||
}
|
||||
|
||||
if (workspace == null) {
|
||||
ctx.error('Workspace not found in selectWorkspace', { workspaceUrl, kind, accountUuid, extra })
|
||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.WorkspaceNotFound, { workspaceUrl }))
|
||||
}
|
||||
|
||||
@ -599,6 +600,17 @@ export async function selectWorkspace (
|
||||
role: AccountRole.DocGuest
|
||||
}
|
||||
}
|
||||
|
||||
if (accountUuid === systemAccountUuid || extra?.admin === 'true') {
|
||||
return {
|
||||
account: accountUuid,
|
||||
token: generateToken(accountUuid, workspace.uuid, extra),
|
||||
endpoint: getEndpoint(workspace.uuid, workspace.region, getKind(workspace.region)),
|
||||
workspace: workspace.uuid,
|
||||
workspaceUrl: workspace.url,
|
||||
role: AccountRole.Owner
|
||||
}
|
||||
}
|
||||
|
||||
let role = await db.getWorkspaceRole(accountUuid, workspace.uuid)
|
||||
let account = await db.account.findOne({ uuid: accountUuid })
|
||||
@ -622,17 +634,6 @@ export async function selectWorkspace (
|
||||
void setTimezoneIfNotDefined(ctx, db, accountUuid, account, meta)
|
||||
}
|
||||
|
||||
if (accountUuid === systemAccountUuid || extra?.admin === 'true') {
|
||||
return {
|
||||
account: accountUuid,
|
||||
token: generateToken(accountUuid, workspace.uuid, extra),
|
||||
endpoint: getEndpoint(workspace.uuid, workspace.region, getKind(workspace.region)),
|
||||
workspace: workspace.uuid,
|
||||
workspaceUrl: workspace.url,
|
||||
role: AccountRole.Owner
|
||||
}
|
||||
}
|
||||
|
||||
if (role === AccountRole.ReadOnlyGuest) {
|
||||
if (extra == null) {
|
||||
extra = {}
|
||||
|
Loading…
Reference in New Issue
Block a user