Skip to content

Commit

Permalink
Merge #53329
Browse files Browse the repository at this point in the history
53329: server: make the `/_admin/v1/location` endpoint usable by non-admins r=ajwerner a=knz

Fixes  #45089

This unlocks the cluster node map and the localities view for non-admin users.

Release justification: low risk, high benefit changes to existing functionality

Release note (bug fix): The cluster node map (enterprise feature) and
the debug page to list cluster localities are now available to
non-admin users.

Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
craig[bot] and knz committed Aug 27, 2020
2 parents 0d75cb4 + 3e364e9 commit 59a52f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/server/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ func (s *adminServer) Locations(
) (*serverpb.LocationsResponse, error) {
ctx = s.server.AnnotateCtx(ctx)

userName, err := userFromContext(ctx)
_, err := userFromContext(ctx)
if err != nil {
return nil, err
}
Expand All @@ -1501,7 +1501,7 @@ func (s *adminServer) Locations(
q.Append(`SELECT "localityKey", "localityValue", latitude, longitude FROM system.locations`)
rows, cols, err := s.server.sqlServer.internalExecutor.QueryWithCols(
ctx, "admin-locations", nil, /* txn */
sessiondata.InternalExecutorOverride{User: userName},
sessiondata.InternalExecutorOverride{User: security.RootUser},
q.String(),
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ func TestAdminAPILocations(t *testing.T) {
)
}
var res serverpb.LocationsResponse
if err := getAdminJSONProto(s, "locations", &res); err != nil {
if err := getAdminJSONProtoWithAdminOption(s, "locations", &res, false /* isAdmin */); err != nil {
t.Fatal(err)
}
for i, loc := range testLocations {
Expand Down

0 comments on commit 59a52f1

Please sign in to comment.