Allow team user to view host details page (#1033)

Fixes #1019
This commit is contained in:
Zach Wasserman 2021-06-09 13:09:43 -07:00 committed by GitHub
parent 8c97b36764
commit e8bb0f9eb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}