@@ -37,8 +37,9 @@ type GenericConsentManagementProviderConfig struct {
37
37
Filters and returns destinations based on the consents configured for the destination and the user consents present in the event.
38
38
39
39
Supports legacy and generic consent management.
40
+ For GCM based filtering, uses source and destination IDs to fetch the appropriate GCM data from the config.
40
41
*/
41
- func (proc * Handle ) getConsentFilteredDestinations (event types.SingularEventT , destinations []backendconfig.DestinationT ) []backendconfig.DestinationT {
42
+ func (proc * Handle ) getConsentFilteredDestinations (event types.SingularEventT , sourceID string , destinations []backendconfig.DestinationT ) []backendconfig.DestinationT {
42
43
// If the event does not have denied consent IDs, do not filter any destinations
43
44
consentManagementInfo , err := getConsentManagementInfo (event )
44
45
if err != nil {
@@ -52,7 +53,7 @@ func (proc *Handle) getConsentFilteredDestinations(event types.SingularEventT, d
52
53
53
54
return lo .Filter (destinations , func (dest backendconfig.DestinationT , _ int ) bool {
54
55
// Generic consent management
55
- if cmpData := proc .getGCMData (dest .ID , consentManagementInfo .Provider ); len (cmpData .Consents ) > 0 {
56
+ if cmpData := proc .getGCMData (sourceID , dest .ID , consentManagementInfo .Provider ); len (cmpData .Consents ) > 0 {
56
57
57
58
finalResolutionStrategy := consentManagementInfo .ResolutionStrategy
58
59
@@ -103,17 +104,17 @@ func (proc *Handle) getKetchConsentData(destinationID string) []string {
103
104
return proc .config .ketchConsentCategoriesMap [destinationID ]
104
105
}
105
106
106
- func (proc * Handle ) getGCMData (destinationID , provider string ) GenericConsentManagementProviderData {
107
+ func (proc * Handle ) getGCMData (sourceID , destinationID , provider string ) GenericConsentManagementProviderData {
107
108
proc .config .configSubscriberLock .RLock ()
108
109
defer proc .config .configSubscriberLock .RUnlock ()
109
110
110
111
defRetVal := GenericConsentManagementProviderData {}
111
- destinationData , ok := proc .config .destGenericConsentManagementMap [ destinationID ]
112
+ destinationData , ok := proc .config .genericConsentManagementMap [ SourceID ( sourceID )][ DestinationID ( destinationID ) ]
112
113
if ! ok {
113
114
return defRetVal
114
115
}
115
116
116
- providerData , ok := destinationData [provider ]
117
+ providerData , ok := destinationData [ConsentProviderKey ( provider ) ]
117
118
if ! ok {
118
119
return defRetVal
119
120
}
@@ -161,8 +162,8 @@ func getKetchConsentCategories(dest *backendconfig.DestinationT) []string {
161
162
})
162
163
}
163
164
164
- func getGenericConsentManagementData (dest * backendconfig.DestinationT ) (map [ string ] GenericConsentManagementProviderData , error ) {
165
- genericConsentManagementData := make (map [ string ] GenericConsentManagementProviderData )
165
+ func getGenericConsentManagementData (dest * backendconfig.DestinationT ) (ConsentProviderMap , error ) {
166
+ genericConsentManagementData := make (ConsentProviderMap )
166
167
167
168
if _ , ok := dest .Config ["consentManagement" ]; ! ok {
168
169
return genericConsentManagementData , nil
@@ -192,7 +193,7 @@ func getGenericConsentManagementData(dest *backendconfig.DestinationT) (map[stri
192
193
)
193
194
194
195
if len (consentIDs ) > 0 {
195
- genericConsentManagementData [providerConfig .Provider ] = GenericConsentManagementProviderData {
196
+ genericConsentManagementData [ConsentProviderKey ( providerConfig .Provider ) ] = GenericConsentManagementProviderData {
196
197
ResolutionStrategy : providerConfig .ResolutionStrategy ,
197
198
Consents : consentIDs ,
198
199
}
0 commit comments