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)
| 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. |
| 1699 | func 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 |
| 1710 | func addChannelsToPrincipal(config PrincipalConfigForWrite, ds sgbucket.DataStore, chans []string) ([]byte, error) { |