in pkg/client/sonar/permission_template.go [261:282]
func (sc *Client) GetGroupPermissions(ctx context.Context, groupName string) ([]string, error) {
response := getGroupPermissionResponse{}
rsp, err := sc.startRequest(ctx).
SetResult(&response).
SetQueryParams(map[string]string{
"q": groupName,
"ps": "100",
}).
Get("/permissions/groups")
if err = sc.checkError(rsp, err); err != nil {
return nil, fmt.Errorf("failed to get group %s permission: %w", groupName, err)
}
for _, g := range response.Groups {
if g.Name == groupName {
return g.Permissions, nil
}
}
return nil, NewHTTPError(http.StatusNotFound, fmt.Sprintf("group %s not found", groupName))
}