From e4167487f253110b75c89bde60080095bbaee2b7 Mon Sep 17 00:00:00 2001 From: Gabriel Mougard Date: Sat, 16 Nov 2024 19:32:31 +0100 Subject: [PATCH] lxd/identities: Add `FineGrained` field to the `GET /1.0/auth/identities/current` endpoint This is needed to let know the client if the currently used identity is fine-grained or not. Signed-off-by: Gabriel Mougard --- lxd/identities.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lxd/identities.go b/lxd/identities.go index c124524a1e4b..120301d55989 100644 --- a/lxd/identities.go +++ b/lxd/identities.go @@ -1126,6 +1126,7 @@ func getCurrentIdentityInfo(d *Daemon, r *http.Request) response.Response { Identity: *apiIdentity, EffectiveGroups: effectiveGroups, EffectivePermissions: effectivePermissions, + FineGrained: identity.IsFineGrainedIdentityType(apiIdentity.Type), }) } @@ -1884,7 +1885,8 @@ func updateIdentityCacheFromLocal(d *Daemon) error { return fmt.Errorf("Failed reading certificates from local database: %w", err) } - var identityCacheEntries []identity.CacheEntry + // identityCacheEntries needs to be pre-allocated. + identityCacheEntries := make([]identity.CacheEntry, 0) for _, dbCert := range localServerCerts { certBlock, _ := pem.Decode([]byte(dbCert.Certificate)) if certBlock == nil {