From e8bb0f9eb545c8079884520a3bbabe8529b9eb65 Mon Sep 17 00:00:00 2001 From: Zach Wasserman Date: Wed, 9 Jun 2021 13:09:43 -0700 Subject: [PATCH] Allow team user to view host details page (#1033) Fixes #1019 --- server/service/service_hosts.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/service/service_hosts.go b/server/service/service_hosts.go index 0943a33287..f60409d11a 100644 --- a/server/service/service_hosts.go +++ b/server/service/service_hosts.go @@ -23,7 +23,9 @@ func (svc Service) ListHosts(ctx context.Context, opt fleet.HostListOptions) ([] } func (svc Service) GetHost(ctx context.Context, id uint) (*fleet.HostDetail, error) { - if err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionRead); err != nil { + // First ensure the user has access to list hosts, then check the specific + // host once team_id is loaded. + if err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionList); err != nil { return nil, err }