Add comment on functions

This commit is contained in:
Thomas LAY
2020-04-06 12:25:25 +02:00
parent 9a1d3523ab
commit 2ad493c354
5 changed files with 26 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ type AllowedVendors struct {
RangeEntries []*RangeEntry
}
// Returns true if vendor id is allowed for OOB signaling
func (a *AllowedVendors) IsVendorAllowed(id int) bool {
if a.IsRangeEncoding {
for _, entry := range a.RangeEntries {
@@ -26,6 +27,7 @@ func (a *AllowedVendors) IsVendorAllowed(id int) bool {
return a.AllowedVendors[id]
}
// Returns structure as a base64 raw url encoded string
func (a *AllowedVendors) Encode() string {
bitSize := 20

View File

@@ -48,18 +48,23 @@ type RangeEntry struct {
EndVendorID int
}
// Returns true if user has given consent to special feature id
func (c *CoreString) IsSpecialFeatureAllowed(id int) bool {
return c.SpecialFeatureOptIns[id]
}
// Returns true if user has given consent to purpose id
func (c *CoreString) IsPurposeAllowed(id int) bool {
return c.PurposesConsent[id]
}
// Returns true if legitimate interest is established for purpose id
// and user didn't exercise their right to object
func (c *CoreString) IsPurposeLIAllowed(id int) bool {
return c.PurposesLITransparency[id]
}
// Returns true if user has given consent to vendor id processing their personal data
func (c *CoreString) IsVendorAllowed(id int) bool {
if c.IsRangeEncoding {
for _, entry := range c.RangeEntries {
@@ -73,6 +78,8 @@ func (c *CoreString) IsVendorAllowed(id int) bool {
return c.VendorsConsent[id]
}
// Returns true if transparency for vendor id's legitimate interest is established
// and user didn't exercise their right to object
func (c *CoreString) IsVendorLIAllowed(id int) bool {
if c.IsRangeEncodingLI {
for _, entry := range c.RangeEntriesLI {
@@ -86,6 +93,7 @@ func (c *CoreString) IsVendorLIAllowed(id int) bool {
return c.VendorsLITransparency[id]
}
// Returns structure as a base64 raw url encoded string
func (c *CoreString) Encode() string {
bitSize := 230

View File

@@ -13,6 +13,7 @@ type DisclosedVendors struct {
RangeEntries []*RangeEntry
}
// Returns true if vendor id is disclosed for validating OOB signaling
func (d *DisclosedVendors) IsVendorDisclosed(id int) bool {
if d.IsRangeEncoding {
for _, entry := range d.RangeEntries {
@@ -26,6 +27,7 @@ func (d *DisclosedVendors) IsVendorDisclosed(id int) bool {
return d.DisclosedVendors[id]
}
// Returns structure as a base64 raw url encoded string
func (d *DisclosedVendors) Encode() string {
bitSize := 20

View File

@@ -11,22 +11,29 @@ type PublisherTC struct {
CustomPurposesLITransparency map[int]bool
}
// Returns true if user has given consent to standard purpose id
func (p *PublisherTC) IsPurposeAllowed(id int) bool {
return p.PubPurposesConsent[id]
}
// Returns true if legitimate interest is established for standard purpose id
// and user didn't exercise their right to object
func (p *PublisherTC) IsPurposeLIAllowed(id int) bool {
return p.PubPurposesLITransparency[id]
}
// Returns true if user has given consent to custom purpose id
func (p *PublisherTC) IsCustomPurposeAllowed(id int) bool {
return p.CustomPurposesConsent[id]
}
// Returns true if legitimate interest is established for custom purpose id
// and user didn't exercise their right to object
func (p *PublisherTC) IsCustomPurposeLIAllowed(id int) bool {
return p.CustomPurposesLITransparency[id]
}
// Returns structure as a base64 raw url encoded string
func (p *PublisherTC) Encode() string {
bitSize := 57 + (p.NumCustomPurposes * 2)

View File

@@ -16,22 +16,29 @@ type TCData struct {
PublisherTC *PublisherTC
}
// Returns true if user has given consent to purpose id
func (t *TCData) IsPurposeAllowed(id int) bool {
return t.CoreString.IsPurposeAllowed(id)
}
// Returns true if legitimate interest is established for purpose id
// and user didn't exercise their right to object
func (t *TCData) IsPurposeLIAllowed(id int) bool {
return t.CoreString.IsPurposeLIAllowed(id)
}
// Returns true if user has given consent to vendor id processing their personal data
func (t *TCData) IsVendorAllowed(id int) bool {
return t.CoreString.IsVendorAllowed(id)
}
// Returns true if transparency for vendor id's legitimate interest is established
// and user didn't exercise their right to object
func (t *TCData) IsVendorLIAllowed(id int) bool {
return t.CoreString.IsVendorLIAllowed(id)
}
// Returns structure as a base64 raw url encoded string
func (t *TCData) ToTCString() string {
var segments []string