Skip to content

Commit

Permalink
Privacy Activity Config (#2740)
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxNode authored May 18, 2023
1 parent 4492a17 commit 324d293
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/accounts.go → config/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Account struct {
Validations Validations `mapstructure:"validations" json:"validations"`
DefaultBidLimit int `mapstructure:"default_bid_limit" json:"default_bid_limit"`
BidAdjustments *openrtb_ext.ExtRequestPrebidBidAdjustments `mapstructure:"bidadjustments" json:"bidadjustments"`
Privacy AccountPrivacy `mapstructure:"privacy" json:"privacy"`
}

// CookieSync represents the account-level defaults for the cookie sync endpoint.
Expand Down Expand Up @@ -291,3 +292,7 @@ func (m AccountModules) ModuleConfig(id string) (json.RawMessage, error) {
func (a *AccountChannel) IsSet() bool {
return a.AMP != nil || a.App != nil || a.Video != nil || a.Web != nil
}

type AccountPrivacy struct {
AllowActivities AllowActivities `mapstructure:"allowactivities" json:"allowactivities"`
}
File renamed without changes.
26 changes: 26 additions & 0 deletions config/activity.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package config

type AllowActivities struct {
SyncUser Activity `mapstructure:"syncUser" json:"syncUser"`
FetchBids Activity `mapstructure:"fetchBids" json:"fetchBids"`
EnrichUserFPD Activity `mapstructure:"enrichUfpd" json:"enrichUfpd"`
ReportAnalytics Activity `mapstructure:"reportAnalytics" json:"reportAnalytics"`
TransmitUserFPD Activity `mapstructure:"transmitUfpd" json:"transmitUfpd"`
TransmitPreciseGeo Activity `mapstructure:"transmitPreciseGeo" json:"transmitPreciseGeo"`
TransmitUniqueRequestIds Activity `mapstructure:"transmitUniqueRequestIds" json:"transmitUniqueRequestIds"`
}

type Activity struct {
Default *bool `mapstructure:"default" json:"default"`
Rules []ActivityRule `mapstructure:"rules" json:"rules"`
Allow bool `mapstructure:"allow" json:"allow"`
}

type ActivityRule struct {
Condition ActivityCondition `mapstructure:"condition" json:"condition"`
}

type ActivityCondition struct {
ComponentName []string `mapstructure:"componentName" json:"componentName"`
ComponentType []string `mapstructure:"componentType" json:"componentType"`
}
35 changes: 35 additions & 0 deletions privacy/activity.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package privacy

// Activity defines privileges which can be controlled directly by the publisher or via privacy policies.
type Activity int

const (
ActivitySyncUser Activity = iota + 1
ActivityFetchBids
ActivityEnrichUserFPD
ActivityReportAnalytics
ActivityTransmitUserFPD
ActivityTransmitPreciseGeo
ActivityTransmitUniqueRequestIds
)

func (a Activity) String() string {
switch a {
case ActivitySyncUser:
return "syncUser"
case ActivityFetchBids:
return "fetchBids"
case ActivityEnrichUserFPD:
return "enrichUfpd"
case ActivityReportAnalytics:
return "reportAnalytics"
case ActivityTransmitUserFPD:
return "transmitUfpd"
case ActivityTransmitPreciseGeo:
return "transmitPreciseGeo"
case ActivityTransmitUniqueRequestIds:
return "transmitUniqueRequestIds"
}

return ""
}

0 comments on commit 324d293

Please sign in to comment.