AccessControl: Present user edit actions according to AC metadata (#43602)
* AccessControl: Add user metadata to user detail view * AccessControl: Do not present delete or disable buttons based on ac metadata in admin/users * AccessControl: do not allow password changing or user editing without permission * AccessControl: Fetch global:users scope for admin * AccessControl: optimize org.user metadata fetch * Chore: early return if ac metadata is not available
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/searchusers/filters"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/searchusers"
|
||||
|
||||
@@ -20,6 +22,12 @@ import (
|
||||
)
|
||||
|
||||
func TestUserAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
settings := setting.NewCfg()
|
||||
hs := &HTTPServer{Cfg: settings}
|
||||
|
||||
sqlStore := sqlstore.InitTestDB(t)
|
||||
hs.SQLStore = sqlStore
|
||||
|
||||
mockResult := models.SearchUserQueryResult{
|
||||
Users: []*models.UserSearchHitDTO{
|
||||
{Name: "user1"},
|
||||
@@ -53,7 +61,7 @@ func TestUserAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
|
||||
sc.handlerFunc = GetUserByID
|
||||
sc.handlerFunc = hs.GetUserByID
|
||||
avatarUrl := dtos.GetGravatarUrl("daniel@grafana.com")
|
||||
sc.fakeReqWithParams("GET", sc.url, map[string]string{}).exec()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user