func (ps *PublishService) GetAllowedPublishedServices(apiListRequestedServices []publishapi.ServiceAPIDescription) []publishapi.ServiceAPIDescription {
apiListAllPublished := ps.GetAllPublishedServices()
- allowedPublishedServices := intersection(apiListAllPublished, apiListRequestedServices)
+ allowedPublishedServices := join(apiListAllPublished, apiListRequestedServices)
return allowedPublishedServices
}
-func intersection(a, b []publishapi.ServiceAPIDescription) []publishapi.ServiceAPIDescription {
+func join(a, b []publishapi.ServiceAPIDescription) []publishapi.ServiceAPIDescription {
var result []publishapi.ServiceAPIDescription
if (a == nil) || (b == nil) || (len(a) == 0) || (len(b) == 0) {
for _, itemA := range a {
for _, itemB := range b {
- if (itemA.ApiId != nil) && (itemB.ApiId != nil) && (*itemA.ApiId == *itemB.ApiId) {
+ if itemA.ApiName == itemB.ApiName {
result = append(result, itemA)
break
}