CreateRole creates a role with channels scoped to a single test collection.
(rolename string, channels []string)
| 552 | |
| 553 | // CreateRole creates a role with channels scoped to a single test collection. |
| 554 | func (rt *RestTester) CreateRole(rolename string, channels []string) { |
| 555 | var response *TestResponse |
| 556 | if rt.AdminInterfaceAuthentication { |
| 557 | response = rt.SendAdminRequestWithAuth(http.MethodPut, "/{{.db}}/_role/"+rolename, GetRolePayload(rt.TB(), rolename, rt.GetSingleDataStore(), channels), base.TestClusterUsername(), base.TestClusterPassword()) |
| 558 | } else { |
| 559 | response = rt.SendAdminRequest(http.MethodPut, "/{{.db}}/_role/"+rolename, GetRolePayload(rt.TB(), rolename, rt.GetSingleDataStore(), channels)) |
| 560 | } |
| 561 | RequireStatus(rt.TB(), response, http.StatusCreated) |
| 562 | } |
| 563 | |
| 564 | func (rt *RestTester) GetUserAdminAPI(username string) auth.PrincipalConfig { |
| 565 | response := rt.SendAdminRequest(http.MethodGet, "/{{.db}}/_user/"+username, "") |