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

Commit

Permalink
Fixed issue with first user not being made admin
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzlamateen committed Oct 23, 2023
1 parent d92b107 commit b137218
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit b137218

Please sign in to comment.