Extract Crisp admin check into a helper
IsAdmin was the one derived AccountRecord field computed inline in the struct literal, while Crisp's roles and full name already go through helpers and the sibling Yousign driver uses a yousignIsAdmin helper. Move it to crispIsAdmin for consistency; behaviour is unchanged (only the website owner is an administrator). Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -140,7 +140,7 @@ func (d *CrispDriver) ListAccounts(ctx context.Context) ([]AccountRecord, error)
|
||||
FullName: crispFullName(details, email),
|
||||
Roles: crispRoles(details.Role),
|
||||
JobTitle: strings.TrimSpace(details.Title),
|
||||
IsAdmin: strings.EqualFold(strings.TrimSpace(details.Role), "owner"),
|
||||
IsAdmin: crispIsAdmin(details.Role),
|
||||
MFAStatus: coredata.MFAStatusUnknown,
|
||||
AuthMethod: coredata.AccessReviewEntryAuthMethodUnknown,
|
||||
AccountType: coredata.AccessReviewEntryAccountTypeUser,
|
||||
@@ -235,3 +235,9 @@ func crispRoles(role string) []string {
|
||||
return []string{}
|
||||
}
|
||||
}
|
||||
|
||||
// crispIsAdmin reports whether a Crisp operator role grants administrative
|
||||
// access. Only the website owner is an administrator; members are not.
|
||||
func crispIsAdmin(role string) bool {
|
||||
return strings.EqualFold(strings.TrimSpace(role), "owner")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user