RBAC: remove some IsDisabled checks (#69272)

* remove some access contorl IsDisabled() checks

* cleaning up tests

* update tests

* linting
This commit is contained in:
Ieva
2023-05-31 09:58:57 +01:00
committed by GitHub
parent 0645106184
commit d8b66d5c4b
18 changed files with 57 additions and 531 deletions

View File

@ -139,26 +139,6 @@ func TestAlertingProxy_createProxyContext(t *testing.T) {
}
})
})
t.Run("if access control is disabled", func(t *testing.T) {
t.Run("should not alter user", func(t *testing.T) {
proxy := AlertingProxy{
DataProxy: nil,
ac: accesscontrolmock.New().WithDisabled(),
}
req := &http.Request{}
resp := &response.NormalResponse{}
for _, roleType := range []org.RoleType{org.RoleViewer, org.RoleEditor, org.RoleAdmin} {
roleCtx := *ctx
roleCtx.SignedInUser = &user.SignedInUser{
OrgRole: roleType,
}
newCtx := proxy.createProxyContext(&roleCtx, req, resp)
require.Equalf(t, roleCtx.SignedInUser, newCtx.SignedInUser, "user should not be altered if access control is disabled and role is %s", roleType)
}
})
})
}
func Test_containsProvisionedAlerts(t *testing.T) {