authz: set authzv1.ReadResponse.Found (#91212)

Co-authored-by: Gabriel MABILLE <gabriel.mabille@grafana.com>
This commit is contained in:
Claudiu Dragalina-Paraipan 2024-07-30 18:26:54 +03:00 committed by GitHub
parent 66b1a219f4
commit cf55ac5813
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,8 @@ func (s *legacyServer) Read(ctx context.Context, req *authzv1.ReadRequest) (*aut
ctx, span := s.tracer.Start(ctx, "authz.grpc.Read")
defer span.End()
// FIXME: once we have access tokens, we need to do namespace validation here
action := req.GetAction()
subject := req.GetSubject()
stackID := req.GetStackId() // TODO can we consider the stackID as the orgID?
@ -74,5 +76,8 @@ func (s *legacyServer) Read(ctx context.Context, req *authzv1.ReadRequest) (*aut
for _, perm := range permissions {
data = append(data, &authzv1.ReadResponse_Data{Object: perm.Scope})
}
return &authzv1.ReadResponse{Data: data}, nil
return &authzv1.ReadResponse{
Data: data,
Found: len(data) > 0,
}, nil
}