Extract Scaleway admin check into a helper

Match the Crisp and Yousign drivers: move the inline owner check out of
the AccountRecord literal into scalewayIsAdmin, alongside the existing
scalewayRoles/scalewayActive helpers. Behaviour is unchanged (only the
organization owner is an administrator).

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-07-11 18:10:02 +02:00
parent 42de253d44
commit 53eb5de7be

View File

@@ -98,7 +98,7 @@ func (d *ScalewayDriver) ListAccounts(ctx context.Context) ([]AccountRecord, err
FullName: scalewayFullName(u, email),
Roles: scalewayRoles(u.Type),
Active: scalewayActive(u.Status, u.Locked),
IsAdmin: strings.EqualFold(strings.TrimSpace(u.Type), "owner"),
IsAdmin: scalewayIsAdmin(u.Type),
MFAStatus: scalewayMFAStatus(u),
AuthMethod: coredata.AccessReviewEntryAuthMethodUnknown,
AccountType: coredata.AccessReviewEntryAccountTypeUser,
@@ -194,6 +194,12 @@ func scalewayRoles(userType string) []string {
}
}
// scalewayIsAdmin reports whether a Scaleway user type grants administrative
// access. Only the organization owner is an administrator; members are not.
func scalewayIsAdmin(userType string) bool {
return strings.EqualFold(strings.TrimSpace(userType), "owner")
}
// scalewayActive maps the Scaleway user status to the three-valued Active
// signal. A locked account is always inactive; otherwise only the documented
// "activated"/"invitation_pending" values are an explicit signal and any other