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

Function GetRolePayload

rest/utilities_testing.go:1699–1707  ·  view source on GitHub ↗

GetRolePayload will take roleName and channels you want to assign a particular role and return the appropriate payload for the _role endpoint For default collection, follows same handling as GetUserPayload for chans.

(t testing.TB, roleName string, collection sgbucket.DataStore, chans []string)

Source from the content-addressed store, hash-verified

1697// GetRolePayload will take roleName and channels you want to assign a particular role and return the appropriate payload for the _role endpoint
1698// For default collection, follows same handling as GetUserPayload for chans.
1699func GetRolePayload(t testing.TB, roleName string, collection sgbucket.DataStore, chans []string) string {
1700 config := PrincipalConfigForWrite{}
1701 if roleName != "" {
1702 config.Name = &roleName
1703 }
1704 marshalledConfig, err := addChannelsToPrincipal(config, collection, chans)
1705 require.NoError(t, err)
1706 return string(marshalledConfig)
1707}
1708
1709// add channels to principal depending if running with collections or not. then marshal the principal config
1710func addChannelsToPrincipal(config PrincipalConfigForWrite, ds sgbucket.DataStore, chans []string) ([]byte, error) {

Calls 1

addChannelsToPrincipalFunction · 0.85