Skip to content

Commit

Permalink
fix(workspaces): display warning if workspace has no authStrategies (#…
Browse files Browse the repository at this point in the history
…11679)

* fix(workspaces): display warning if workspace has no authStrategies

* add null check
  • Loading branch information
laurentlp committed Mar 30, 2022
1 parent e1f84e0 commit 52c4e95
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/bp/src/core/users/workspace-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,20 @@ export class WorkspaceService {
) {}

async initialize(): Promise<void> {
await this.getWorkspaces().catch(async () => {
try {
const workspaces = await this.getWorkspaces()

for (const workspace of workspaces) {
if ((workspace.authStrategies || []).length === 0) {
this.logger.warn(
`Workspace [${workspace.name}] does not contain any Authentication Strategies ('authStrategies'). This can result in unwanted behavior.`
)
}
}
} catch {
await this.save([defaultWorkspace])
this.logger.info('Created workspace')
})
}
}

async getWorkspaces(): Promise<Workspace[]> {
Expand Down

0 comments on commit 52c4e95

Please sign in to comment.