mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-11 21:11:57 +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,
|
uuid: workspaceId,
|
||||||
name: 'Test',
|
name: 'Test',
|
||||||
url: 'test',
|
url: 'test',
|
||||||
|
allowReadOnlyGuest: false,
|
||||||
createdOn: 1234567890000,
|
createdOn: 1234567890000,
|
||||||
status: {
|
status: {
|
||||||
mode: 'active',
|
mode: 'active',
|
||||||
|
@ -1098,6 +1098,7 @@ describe('account utils', () => {
|
|||||||
const mockWorkspace = {
|
const mockWorkspace = {
|
||||||
uuid: 'workspace-uuid' as WorkspaceUuid,
|
uuid: 'workspace-uuid' as WorkspaceUuid,
|
||||||
url: workspaceUrl,
|
url: workspaceUrl,
|
||||||
|
allowReadOnlyGuest: false,
|
||||||
region: 'us',
|
region: 'us',
|
||||||
dataId: 'test-data-id'
|
dataId: 'test-data-id'
|
||||||
}
|
}
|
||||||
|
@ -565,6 +565,7 @@ export async function selectWorkspace (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (workspace == null) {
|
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 }))
|
throw new PlatformError(new Status(Severity.ERROR, platform.status.WorkspaceNotFound, { workspaceUrl }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,6 +600,17 @@ export async function selectWorkspace (
|
|||||||
role: AccountRole.DocGuest
|
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 role = await db.getWorkspaceRole(accountUuid, workspace.uuid)
|
||||||
let account = await db.account.findOne({ uuid: accountUuid })
|
let account = await db.account.findOne({ uuid: accountUuid })
|
||||||
@ -622,17 +634,6 @@ export async function selectWorkspace (
|
|||||||
void setTimezoneIfNotDefined(ctx, db, accountUuid, account, meta)
|
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 (role === AccountRole.ReadOnlyGuest) {
|
||||||
if (extra == null) {
|
if (extra == null) {
|
||||||
extra = {}
|
extra = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user