MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / CreateRole

Method CreateRole

rest/utilities_testing.go:554–562  ·  view source on GitHub ↗

CreateRole creates a role with channels scoped to a single test collection.

(rolename string, channels []string)

Source from the content-addressed store, hash-verified

552
553// CreateRole creates a role with channels scoped to a single test collection.
554func (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
564func (rt *RestTester) GetUserAdminAPI(username string) auth.PrincipalConfig {
565 response := rt.SendAdminRequest(http.MethodGet, "/{{.db}}/_user/"+username, "")

Callers 1

TestAuditLoggingFieldsFunction · 0.95

Calls 8

TBMethod · 0.95
GetSingleDataStoreMethod · 0.95
SendAdminRequestMethod · 0.95
TestClusterUsernameFunction · 0.92
TestClusterPasswordFunction · 0.92
GetRolePayloadFunction · 0.85
RequireStatusFunction · 0.85

Tested by 1

TestAuditLoggingFieldsFunction · 0.76