github.com/prebid/prebid-server/v2@v2.18.0/gdpr/purpose_config.go (about) 1 package gdpr 2 3 import ( 4 "github.com/prebid/go-gdpr/consentconstants" 5 "github.com/prebid/prebid-server/v2/config" 6 ) 7 8 // purposeConfig represents all of the config info selected from the host and account configs for 9 // a particular purpose needed to determine legal basis using one of the GDPR enforcement algorithms 10 type purposeConfig struct { 11 PurposeID consentconstants.Purpose 12 EnforceAlgo config.TCF2EnforcementAlgo 13 EnforcePurpose bool 14 EnforceVendors bool 15 VendorExceptionMap map[string]struct{} 16 BasicEnforcementVendorsMap map[string]struct{} 17 } 18 19 // basicEnforcementVendor returns true if a given bidder/analytics adapter is configured as a basic enforcement vendor 20 // for the purpose 21 func (pc *purposeConfig) basicEnforcementVendor(name string) bool { 22 if pc.BasicEnforcementVendorsMap == nil { 23 return false 24 } 25 _, found := pc.BasicEnforcementVendorsMap[name] 26 return found 27 } 28 29 // vendorException returns true if a given bidder/analytics adapter is configured as a vendor exception 30 // for the purpose 31 func (pc *purposeConfig) vendorException(name string) bool { 32 if pc.VendorExceptionMap == nil { 33 return false 34 } 35 _, found := pc.VendorExceptionMap[name] 36 return found 37 }