NONRTRIC-946: Fix panics in Capif
[nonrtric/plt/sme.git] / capifcore / internal / providermanagementapi / typeaccess.go
index 78b68c0..b1894d4 100644 (file)
@@ -22,7 +22,7 @@ package providermanagementapi
 
 func (ed APIProviderEnrolmentDetails) GetExposingFunctionIdsForPublisher(apfId string) []string {
        for _, registeredFunc := range *ed.ApiProvFuncs {
-               if *registeredFunc.ApiProvFuncId == apfId && registeredFunc.isProvidingFunction() {
+               if *registeredFunc.ApiProvFuncId == apfId {
                        return ed.getExposingFunctionIds()
                }
        }
@@ -48,7 +48,16 @@ func (ed APIProviderEnrolmentDetails) IsFunctionRegistered(functionId string) bo
        return false
 }
 
-func (fd APIProviderFunctionDetails) isProvidingFunction() bool {
+func (ed APIProviderEnrolmentDetails) IsPublishingFunctionRegistered(functionId string) bool {
+       for _, registeredFunc := range *ed.ApiProvFuncs {
+               if *registeredFunc.ApiProvFuncId == functionId && registeredFunc.isPublishingFunction() {
+                       return true
+               }
+       }
+       return false
+}
+
+func (fd APIProviderFunctionDetails) isPublishingFunction() bool {
        return fd.ApiProvFuncRole == ApiProviderFuncRoleAPF
 }