mirror of
https://github.com/cubixle/iabtcfv2.git
synced 2026-04-24 19:54:41 +01:00
Add IsVendorAllowedForFlexiblePurposes/IsVendorAllowedForFlexiblePurposesLI methods for flexible vendors
This commit is contained in:
@@ -143,6 +143,68 @@ func (c *CoreString) IsVendorAllowedForPurposesLI(id int, purposeIds ...int) boo
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if user has given consent to vendor id processing all purposes ids
|
||||||
|
// or if transparency for its legitimate interest is established in accordance with publisher restrictions
|
||||||
|
func (c *CoreString) IsVendorAllowedForFlexiblePurposes(id int, purposeIds ...int) bool {
|
||||||
|
for _, p := range purposeIds {
|
||||||
|
if !c.IsPurposeAllowed(p) && !c.IsPurposeLIAllowed(p) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
pr := c.GetPubRestrictionsForPurpose(p)
|
||||||
|
for _, r := range pr {
|
||||||
|
if r.IsVendorIncluded(id) {
|
||||||
|
if r.RestrictionType == RestrictionTypeNotAllowed {
|
||||||
|
return false
|
||||||
|
} else if r.RestrictionType == RestrictionTypeRequireLI && !c.IsVendorLIAllowed(id) && !c.IsPurposeLIAllowed(p) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !c.IsPurposeAllowed(p) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !c.IsVendorAllowed(id) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if transparency for vendor id's legitimate interest is established for all purpose ids
|
||||||
|
// or if user has given consent in accordance with publisher restrictions
|
||||||
|
func (c *CoreString) IsVendorAllowedForFlexiblePurposesLI(id int, purposeIds ...int) bool {
|
||||||
|
for _, p := range purposeIds {
|
||||||
|
if !c.IsPurposeAllowed(p) && !c.IsPurposeLIAllowed(p) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
pr := c.GetPubRestrictionsForPurpose(p)
|
||||||
|
for _, r := range pr {
|
||||||
|
if r.IsVendorIncluded(id) {
|
||||||
|
if r.RestrictionType == RestrictionTypeNotAllowed {
|
||||||
|
return false
|
||||||
|
} else if r.RestrictionType == RestrictionTypeRequireConsent && !c.IsVendorAllowed(id) && !c.IsPurposeAllowed(p) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !c.IsPurposeLIAllowed(p) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !c.IsVendorLIAllowed(id) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a list of publisher restrictions applied to purpose id
|
// Returns a list of publisher restrictions applied to purpose id
|
||||||
func (c *CoreString) GetPubRestrictionsForPurpose(id int) []*PubRestriction {
|
func (c *CoreString) GetPubRestrictionsForPurpose(id int) []*PubRestriction {
|
||||||
var pr []*PubRestriction
|
var pr []*PubRestriction
|
||||||
|
|||||||
12
tcdata.go
12
tcdata.go
@@ -48,6 +48,18 @@ func (t *TCData) IsVendorAllowedForPurposesLI(id int, purposeIds ...int) bool {
|
|||||||
return t.CoreString.IsVendorAllowedForPurposesLI(id, purposeIds...)
|
return t.CoreString.IsVendorAllowedForPurposesLI(id, purposeIds...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if user has given consent to vendor id processing all purposes ids
|
||||||
|
// or if transparency for its legitimate interest is established in accordance with publisher restrictions
|
||||||
|
func (t *TCData) IsVendorAllowedForFlexiblePurposes(id int, purposeIds ...int) bool {
|
||||||
|
return t.CoreString.IsVendorAllowedForFlexiblePurposes(id, purposeIds...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if transparency for vendor id's legitimate interest is established for all purpose ids
|
||||||
|
// or if user has given consent in accordance with publisher restrictions
|
||||||
|
func (t *TCData) IsVendorAllowedForFlexiblePurposesLI(id int, purposeIds ...int) bool {
|
||||||
|
return t.CoreString.IsVendorAllowedForFlexiblePurposesLI(id, purposeIds...)
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a list of publisher restrictions applied to purpose id
|
// Returns a list of publisher restrictions applied to purpose id
|
||||||
func (t *TCData) GetPubRestrictionsForPurpose(id int) []*PubRestriction {
|
func (t *TCData) GetPubRestrictionsForPurpose(id int) []*PubRestriction {
|
||||||
return t.CoreString.GetPubRestrictionsForPurpose(id)
|
return t.CoreString.GetPubRestrictionsForPurpose(id)
|
||||||
|
|||||||
Reference in New Issue
Block a user