Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Fixed issue with first user not being made admin #9120

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async function addIdentityProviderType(context: HookContext<IdentityProviderServ
context.params!.provider &&
!['password', 'email', 'sms'].includes((context!.data as IdentityProviderData).type)
) {
;(context.data as IdentityProviderData).type = 'guest'
;(context.data as IdentityProviderData).type = 'guest' //Non-password/magiclink create requests must always be for guests
}

const adminScopes = await context.app.service(scopePath).find({
Expand All @@ -139,7 +139,7 @@ async function addIdentityProviderType(context: HookContext<IdentityProviderServ
}
})

if (adminScopes.total === 0 && isDev && (context.data as IdentityProviderData).type !== 'guest') {
if (adminScopes.total === 0 && (isDev || (context.data as IdentityProviderData).type !== 'guest')) {
;(context.data as IdentityProviderData).type = 'admin'
}
}
Expand Down
Loading