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