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