From b0eead58ac78863827c215a88c6a17dfb581eaee Mon Sep 17 00:00:00 2001 From: Nahid Farhady Ghalaty Date: Wed, 20 Nov 2024 11:40:52 -0800 Subject: [PATCH 1/6] Added privacy concern provider --- wrappers/obj-c/ODWPrivacyConcernEvent.h | 111 ++++++++++++++++++ wrappers/obj-c/ODWPrivacyConcernEvent.mm | 13 ++ .../obj-c/ODWPrivacyConcernMetadataProvider.h | 80 +++++++++++++ .../ODWPrivacyConcernMetadataProvider.mm | 51 ++++++++ wrappers/obj-c/ODWPrivacyGuardInitConfig.h | 5 + wrappers/obj-c/OneDsCppSdk.h | 1 + 6 files changed, 261 insertions(+) create mode 100644 wrappers/obj-c/ODWPrivacyConcernEvent.h create mode 100644 wrappers/obj-c/ODWPrivacyConcernEvent.mm create mode 100644 wrappers/obj-c/ODWPrivacyConcernMetadataProvider.h create mode 100644 wrappers/obj-c/ODWPrivacyConcernMetadataProvider.mm diff --git a/wrappers/obj-c/ODWPrivacyConcernEvent.h b/wrappers/obj-c/ODWPrivacyConcernEvent.h new file mode 100644 index 000000000..5e60d125c --- /dev/null +++ b/wrappers/obj-c/ODWPrivacyConcernEvent.h @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 +// +#include "objc_begin.h" + +NS_ASSUME_NONNULL_BEGIN + +/*! + @brief Represents a Privacy Concern Event. + This class is used to store and manage privacy concern event data including details + like the event name, server name, database name, and various other privacy-related + attributes. + */ +@interface PrivacyConcernEvent : NSObject + +/*! + @brief The name of the privacy concern event. + Used as a unique identifier for the event. Example: "PrivacyConcerns". + */ +@property (nonatomic, strong) NSString *PG_ConcernEventName; + +/*! + @brief The name of the server associated with the privacy concern event. + This field is optional and may be nil. + */ +@property (nonatomic, strong, nullable) NSString *PG_ServerName; + +/*! + @brief The name of the database associated with the privacy concern event. + This field is optional and may be nil. + */ +@property (nonatomic, strong, nullable) NSString *PG_DatabaseName; + +/*! + @brief The table name that contains privacy concern event data. + This field is mandatory and used to locate the specific data in a table. + */ +@property (nonatomic, strong) NSString *PG_TableName; + +/*! + @brief The column name in the table that stores the privacy concern data. + This field is mandatory and specifies which column to examine. + */ +@property (nonatomic, strong) NSString *PG_ColumnName; + +/*! + @brief The locator name to uniquely identify the row in the table containing the privacy concern. + This field is optional and can be nil if not needed. + */ +@property (nonatomic, strong, nullable) NSString *PG_EventLocatorName; + +/*! + @brief The locator value associated with the PG_EventLocatorName, which can uniquely identify + the specific row containing the privacy concern. + This field is optional and can be nil if not needed. + */ +@property (nonatomic, strong, nullable) NSString *PG_EventLocatorValue; + +/*! + @brief The timestamp of the privacy concern event. + This field is mandatory and represents the time the event occurred. + */ +@property (nonatomic, assign) int64_t PG_EventTime; + +/*! + @brief The type of privacy concern event as a string. + This field is mandatory and can describe the concern (e.g., "Sensitive Data Leak"). + */ +@property (nonatomic, strong) NSString *PG_ConcernTypeText; + +/*! + @brief Whether the privacy concern event should be ignored. + This boolean determines if the concern will be processed or ignored in reporting. + */ +@property (nonatomic, assign) BOOL PG_ShouldIgnore; + +/*! + @brief Indicates whether the data field is considered as a semantic context. + This boolean indicates if this concern applies universally to the table or to a subset of data. + */ +@property (nonatomic, assign) BOOL PG_IsContext; + +/*! + @brief Indicates whether the semantic context applies to all records or just a subset. + This boolean helps categorize whether the context is global or partial. + */ +@property (nonatomic, assign) BOOL PG_IsGlobalContext; + +/*! + @brief The tenant ID associated with the privacy concern event. + This field is optional and can be used to filter events based on tenant. + */ +@property (nonatomic, strong, nullable) NSString *PG_AssociatedTenant; + +/*! + @brief The environment or deployment ring for the service (e.g., "Production", "PPE"). + This field is optional and can specify the deployment context of the privacy concern. + */ +@property (nonatomic, strong, nullable) NSString *PG_Environment; + +/*! + @brief Additional metadata that can be attached to the privacy concern event. + This field is optional and allows for flexible extension of the event data. + */ +@property (nonatomic, strong, nullable) NSString *PG_Metadata; + +@end + +NS_ASSUME_NONNULL_END +#include "objc_end.h" diff --git a/wrappers/obj-c/ODWPrivacyConcernEvent.mm b/wrappers/obj-c/ODWPrivacyConcernEvent.mm new file mode 100644 index 000000000..e7e794fd3 --- /dev/null +++ b/wrappers/obj-c/ODWPrivacyConcernEvent.mm @@ -0,0 +1,13 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 +// +#import +#import "ODWPrivacyConcernEvent.h" + +/*! + @brief Represents a privacy concern event. + */ +@implementation ODWPrivacyConcernEvent : NSObject + +@end diff --git a/wrappers/obj-c/ODWPrivacyConcernMetadataProvider.h b/wrappers/obj-c/ODWPrivacyConcernMetadataProvider.h new file mode 100644 index 000000000..9e7b16344 --- /dev/null +++ b/wrappers/obj-c/ODWPrivacyConcernMetadataProvider.h @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! + @brief Represents a metadata provider for privacy concern events. + */ +@interface ODWPrivacyConcernMetadataProvider : NSObject + +/*! + @brief Get the database name. + @param record The record for which to retrieve the database name. + @return A string representing the database name. + */ +- (NSString *)getDatabaseNameForRecord:(id)record; + +/*! + @brief Get the server name. + @param record The record for which to retrieve the server name. + @return A string representing the server name. + */ +- (NSString *)getServerNameForRecord:(id)record; + +/*! + @brief Get the event locator name. + @param record The record for which to retrieve the event locator name. + @return A string representing the event locator name. + */ +- (NSString *)getEventLocatorNameForRecord:(id)record; + +/*! + @brief Get the event locator value. + @param record The record for which to retrieve the event locator value. + @return A string representing the event locator value. + */ +- (NSString *)getEventLocatorValueForRecord:(id)record; + +/*! + @brief Get the override for the privacy guard event time. + @param record The record for which to retrieve the event time override. + @return An integer representing the event time override. + */ +- (int64_t)getPrivacyGuardEventTimeOverrideForRecord:(id)record; + +/*! + @brief Check if the record should be ignored. + @param record The record to check. + @return A boolean indicating whether the record should be ignored. + */ +- (BOOL)getShouldIgnoreOverrideForRecord:(id)record; + +/*! + @brief Get the associated tenant. + @param record The record for which to retrieve the associated tenant. + @return A string representing the associated tenant. + */ +- (NSString *)getAssociatedTenantForRecord:(id)record; + +/*! + @brief Get the environment. + @param record The record for which to retrieve the environment. + @return A string representing the environment. + */ +- (NSString *)getEnvironmentForRecord:(id)record; + +/*! + @brief Get the metadata. + @param record The record for which to retrieve the metadata. + @return A string representing the metadata. + */ +- (NSString *)getMetadataForRecord:(id)record; + +@end + +NS_ASSUME_NONNULL_END diff --git a/wrappers/obj-c/ODWPrivacyConcernMetadataProvider.mm b/wrappers/obj-c/ODWPrivacyConcernMetadataProvider.mm new file mode 100644 index 000000000..a8b40a64b --- /dev/null +++ b/wrappers/obj-c/ODWPrivacyConcernMetadataProvider.mm @@ -0,0 +1,51 @@ + +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 +// + +#import +#import "ODWPrivacyConcernMetadataProvider.h" + +/*! + @brief Represents a metadata provider for privacy concern events. + */ +@implementation ODWPrivacyConcernMetadataProvider : NSObject + +- (NSString *)getDatabaseNameForRecord:(id)record { + return @""; // Default implementation +} + +- (NSString *)getServerNameForRecord:(id)record { + return @""; // Default implementation +} + +- (NSString *)getEventLocatorNameForRecord:(id)record { + return @"BaseType"; // Default implementation +} + +- (NSString *)getEventLocatorValueForRecord:(id)record { + return [record baseType]; // Example assuming `record` has a `baseType` property +} + +- (int64_t)getPrivacyGuardEventTimeOverrideForRecord:(id)record { + return [record time]; // Example assuming `record` has a `time` property +} + +- (BOOL)getShouldIgnoreOverrideForRecord:(id)record { + return NO; // Default implementation +} + +- (NSString *)getAssociatedTenantForRecord:(id)record { + return [record iKey]; // Example assuming `record` has an `iKey` property +} + +- (NSString *)getEnvironmentForRecord:(id)record { + return @""; // Default implementation +} + +- (NSString *)getMetadataForRecord:(id)record { + return @""; // Default implementation +} + +@end diff --git a/wrappers/obj-c/ODWPrivacyGuardInitConfig.h b/wrappers/obj-c/ODWPrivacyGuardInitConfig.h index be6261eed..f57986e16 100644 --- a/wrappers/obj-c/ODWPrivacyGuardInitConfig.h +++ b/wrappers/obj-c/ODWPrivacyGuardInitConfig.h @@ -24,6 +24,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property(readwrite, copy, nonatomic) NSString* semanticContextNotificationEventName; +/*! + @brief (OPTIONAL) Privacy Concern Event metadata provider to use with privacyguard. + */ +@property(readwrite, copy, nonatomic) ODWPrivacyConcernMetadataProvider* metadataProvider; + /*! @brief (OPTIONAL) Custom event name to use when logging summary events. Default value is `PrivacyGuardSummary`. */ diff --git a/wrappers/obj-c/OneDsCppSdk.h b/wrappers/obj-c/OneDsCppSdk.h index 51eff5b9c..b9e42e184 100644 --- a/wrappers/obj-c/OneDsCppSdk.h +++ b/wrappers/obj-c/OneDsCppSdk.h @@ -11,6 +11,7 @@ #import "ODWLogConfiguration.h" #import "ODWLogger.h" #import "ODWLogManager.h" +#import "ODWPrivacyConcernEvent.h" #import "ODWPrivacyGuard.h" #import "ODWSemanticContext.h" From 326da18cf15c36594d5d5b7383d7d21343f1f71b Mon Sep 17 00:00:00 2001 From: Nahid Farhady Ghalaty Date: Mon, 25 Nov 2024 21:16:50 -0800 Subject: [PATCH 2/6] Address comments --- lib/include/public/Version.hpp | 6 +++--- wrappers/obj-c/ODWPrivacyConcernEvent.h | 2 +- wrappers/obj-c/ODWPrivacyGuard.mm | 4 ++++ wrappers/obj-c/ODWPrivacyGuardInitConfig.h | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/include/public/Version.hpp b/lib/include/public/Version.hpp index 84d9b1f0a..1d3720803 100644 --- a/lib/include/public/Version.hpp +++ b/lib/include/public/Version.hpp @@ -6,8 +6,8 @@ #define MAT_VERSION_HPP // WARNING: DO NOT MODIFY THIS FILE! // This file has been automatically generated, manual changes will be lost. -#define BUILD_VERSION_STR "3.8.249.1" -#define BUILD_VERSION 3,8,249,1 +#define BUILD_VERSION_STR "3.8.330.1" +#define BUILD_VERSION 3,8,330,1 #ifndef RESOURCE_COMPILER_INVOKED #include "ctmacros.hpp" @@ -18,7 +18,7 @@ namespace MAT_NS_BEGIN { uint64_t const Version = ((uint64_t)3 << 48) | ((uint64_t)8 << 32) | - ((uint64_t)249 << 16) | + ((uint64_t)330 << 16) | ((uint64_t)1); } MAT_NS_END diff --git a/wrappers/obj-c/ODWPrivacyConcernEvent.h b/wrappers/obj-c/ODWPrivacyConcernEvent.h index 5e60d125c..f1d73a6da 100644 --- a/wrappers/obj-c/ODWPrivacyConcernEvent.h +++ b/wrappers/obj-c/ODWPrivacyConcernEvent.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN like the event name, server name, database name, and various other privacy-related attributes. */ -@interface PrivacyConcernEvent : NSObject +@interface ODWPrivacyConcernEvent : NSObject /*! @brief The name of the privacy concern event. diff --git a/wrappers/obj-c/ODWPrivacyGuard.mm b/wrappers/obj-c/ODWPrivacyGuard.mm index 8bd762dbf..69f80f935 100644 --- a/wrappers/obj-c/ODWPrivacyGuard.mm +++ b/wrappers/obj-c/ODWPrivacyGuard.mm @@ -98,6 +98,10 @@ +(void)initializePrivacyGuard:(ILogger *)logger withODWPrivacyGuardInitConfig:(O { config.SemanticContextNotificationEventName = [[initConfigObject semanticContextNotificationEventName] UTF8String]; } + if ([initConfigObject metadataProvider] != nill) + { + config.metadataProvider = [[]] + } if ([initConfigObject summaryEventName] != nil) { config.SummaryEventName = [[initConfigObject summaryEventName] UTF8String]; diff --git a/wrappers/obj-c/ODWPrivacyGuardInitConfig.h b/wrappers/obj-c/ODWPrivacyGuardInitConfig.h index f57986e16..b8285960b 100644 --- a/wrappers/obj-c/ODWPrivacyGuardInitConfig.h +++ b/wrappers/obj-c/ODWPrivacyGuardInitConfig.h @@ -4,6 +4,7 @@ // #include "objc_begin.h" #import "ODWCommonDataContext.h" +#import "ODWPrivacyConcernMetatadataProvider.h" NS_ASSUME_NONNULL_BEGIN /*! From 9cd4b5cdf0b78a4aa7c797b8d245f005e0d9d304 Mon Sep 17 00:00:00 2001 From: Nahid Farhady Ghalaty Date: Tue, 26 Nov 2024 13:32:42 -0800 Subject: [PATCH 3/6] remove privacy concern event --- wrappers/obj-c/ODWPrivacyConcernEvent.h | 111 ----------------------- wrappers/obj-c/ODWPrivacyConcernEvent.mm | 13 --- 2 files changed, 124 deletions(-) delete mode 100644 wrappers/obj-c/ODWPrivacyConcernEvent.h delete mode 100644 wrappers/obj-c/ODWPrivacyConcernEvent.mm diff --git a/wrappers/obj-c/ODWPrivacyConcernEvent.h b/wrappers/obj-c/ODWPrivacyConcernEvent.h deleted file mode 100644 index f1d73a6da..000000000 --- a/wrappers/obj-c/ODWPrivacyConcernEvent.h +++ /dev/null @@ -1,111 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 -// -#include "objc_begin.h" - -NS_ASSUME_NONNULL_BEGIN - -/*! - @brief Represents a Privacy Concern Event. - This class is used to store and manage privacy concern event data including details - like the event name, server name, database name, and various other privacy-related - attributes. - */ -@interface ODWPrivacyConcernEvent : NSObject - -/*! - @brief The name of the privacy concern event. - Used as a unique identifier for the event. Example: "PrivacyConcerns". - */ -@property (nonatomic, strong) NSString *PG_ConcernEventName; - -/*! - @brief The name of the server associated with the privacy concern event. - This field is optional and may be nil. - */ -@property (nonatomic, strong, nullable) NSString *PG_ServerName; - -/*! - @brief The name of the database associated with the privacy concern event. - This field is optional and may be nil. - */ -@property (nonatomic, strong, nullable) NSString *PG_DatabaseName; - -/*! - @brief The table name that contains privacy concern event data. - This field is mandatory and used to locate the specific data in a table. - */ -@property (nonatomic, strong) NSString *PG_TableName; - -/*! - @brief The column name in the table that stores the privacy concern data. - This field is mandatory and specifies which column to examine. - */ -@property (nonatomic, strong) NSString *PG_ColumnName; - -/*! - @brief The locator name to uniquely identify the row in the table containing the privacy concern. - This field is optional and can be nil if not needed. - */ -@property (nonatomic, strong, nullable) NSString *PG_EventLocatorName; - -/*! - @brief The locator value associated with the PG_EventLocatorName, which can uniquely identify - the specific row containing the privacy concern. - This field is optional and can be nil if not needed. - */ -@property (nonatomic, strong, nullable) NSString *PG_EventLocatorValue; - -/*! - @brief The timestamp of the privacy concern event. - This field is mandatory and represents the time the event occurred. - */ -@property (nonatomic, assign) int64_t PG_EventTime; - -/*! - @brief The type of privacy concern event as a string. - This field is mandatory and can describe the concern (e.g., "Sensitive Data Leak"). - */ -@property (nonatomic, strong) NSString *PG_ConcernTypeText; - -/*! - @brief Whether the privacy concern event should be ignored. - This boolean determines if the concern will be processed or ignored in reporting. - */ -@property (nonatomic, assign) BOOL PG_ShouldIgnore; - -/*! - @brief Indicates whether the data field is considered as a semantic context. - This boolean indicates if this concern applies universally to the table or to a subset of data. - */ -@property (nonatomic, assign) BOOL PG_IsContext; - -/*! - @brief Indicates whether the semantic context applies to all records or just a subset. - This boolean helps categorize whether the context is global or partial. - */ -@property (nonatomic, assign) BOOL PG_IsGlobalContext; - -/*! - @brief The tenant ID associated with the privacy concern event. - This field is optional and can be used to filter events based on tenant. - */ -@property (nonatomic, strong, nullable) NSString *PG_AssociatedTenant; - -/*! - @brief The environment or deployment ring for the service (e.g., "Production", "PPE"). - This field is optional and can specify the deployment context of the privacy concern. - */ -@property (nonatomic, strong, nullable) NSString *PG_Environment; - -/*! - @brief Additional metadata that can be attached to the privacy concern event. - This field is optional and allows for flexible extension of the event data. - */ -@property (nonatomic, strong, nullable) NSString *PG_Metadata; - -@end - -NS_ASSUME_NONNULL_END -#include "objc_end.h" diff --git a/wrappers/obj-c/ODWPrivacyConcernEvent.mm b/wrappers/obj-c/ODWPrivacyConcernEvent.mm deleted file mode 100644 index e7e794fd3..000000000 --- a/wrappers/obj-c/ODWPrivacyConcernEvent.mm +++ /dev/null @@ -1,13 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 -// -#import -#import "ODWPrivacyConcernEvent.h" - -/*! - @brief Represents a privacy concern event. - */ -@implementation ODWPrivacyConcernEvent : NSObject - -@end From 16098fe25d18be59d8417270fc1c3fa04ca01ecd Mon Sep 17 00:00:00 2001 From: Nahid Farhady Ghalaty Date: Tue, 26 Nov 2024 13:35:27 -0800 Subject: [PATCH 4/6] revert version --- lib/include/public/Version.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/include/public/Version.hpp b/lib/include/public/Version.hpp index 1d3720803..84d9b1f0a 100644 --- a/lib/include/public/Version.hpp +++ b/lib/include/public/Version.hpp @@ -6,8 +6,8 @@ #define MAT_VERSION_HPP // WARNING: DO NOT MODIFY THIS FILE! // This file has been automatically generated, manual changes will be lost. -#define BUILD_VERSION_STR "3.8.330.1" -#define BUILD_VERSION 3,8,330,1 +#define BUILD_VERSION_STR "3.8.249.1" +#define BUILD_VERSION 3,8,249,1 #ifndef RESOURCE_COMPILER_INVOKED #include "ctmacros.hpp" @@ -18,7 +18,7 @@ namespace MAT_NS_BEGIN { uint64_t const Version = ((uint64_t)3 << 48) | ((uint64_t)8 << 32) | - ((uint64_t)330 << 16) | + ((uint64_t)249 << 16) | ((uint64_t)1); } MAT_NS_END From c12b7963f4124ae5d4cb444d0e2fc827f72c9fc4 Mon Sep 17 00:00:00 2001 From: Nahid Farhady Ghalaty Date: Tue, 26 Nov 2024 13:36:33 -0800 Subject: [PATCH 5/6] remove import --- wrappers/obj-c/OneDsCppSdk.h | 1 - 1 file changed, 1 deletion(-) diff --git a/wrappers/obj-c/OneDsCppSdk.h b/wrappers/obj-c/OneDsCppSdk.h index b9e42e184..51eff5b9c 100644 --- a/wrappers/obj-c/OneDsCppSdk.h +++ b/wrappers/obj-c/OneDsCppSdk.h @@ -11,7 +11,6 @@ #import "ODWLogConfiguration.h" #import "ODWLogger.h" #import "ODWLogManager.h" -#import "ODWPrivacyConcernEvent.h" #import "ODWPrivacyGuard.h" #import "ODWSemanticContext.h" From bb5b255c63ae2cbf6d4f59cc8c754e57cf7b4547 Mon Sep 17 00:00:00 2001 From: Nahid Farhady Ghalaty Date: Wed, 27 Nov 2024 13:34:26 -0800 Subject: [PATCH 6/6] swift wrapper added --- .../Headers/ObjCModule-Bridging-Header.h | 1 + .../PrivacyConcernMetadataProvider.swift | 68 +++++++++++++++++++ .../OneDSSwift/PrivacyGuardInitConfig.swift | 15 +++- 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 wrappers/swift/Sources/OneDSSwift/PrivacyConcernMetadataProvider.swift diff --git a/wrappers/swift/Headers/ObjCModule-Bridging-Header.h b/wrappers/swift/Headers/ObjCModule-Bridging-Header.h index c0e11bcb8..f67d70bf2 100644 --- a/wrappers/swift/Headers/ObjCModule-Bridging-Header.h +++ b/wrappers/swift/Headers/ObjCModule-Bridging-Header.h @@ -12,6 +12,7 @@ #import "../../obj-c/ODWLogConfiguration.h" #import "../../obj-c/ODWLogger.h" #import "../../obj-c/ODWLogManager.h" +#import "../../obj-c/ODWPrivacyConcernMetadataProvider.h" #import "../../obj-c/ODWPrivacyGuard.h" #import "../../obj-c/ODWPrivacyGuardInitConfig.h" #import "../../obj-c/ODWSemanticContext.h" diff --git a/wrappers/swift/Sources/OneDSSwift/PrivacyConcernMetadataProvider.swift b/wrappers/swift/Sources/OneDSSwift/PrivacyConcernMetadataProvider.swift new file mode 100644 index 000000000..84e62b2bd --- /dev/null +++ b/wrappers/swift/Sources/OneDSSwift/PrivacyConcernMetadataProvider.swift @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 +// + +import ObjCModule + +/// Wrapper over ODWPrivacyConcernMetadataProvider class. +public final class PrivacyConcernMetadataProvider { + + /// ObjC variable which is wrapped by Swift. + var odwPrivacyConcernMetadataProvider: ODWPrivacyConcernMetadataProvider + + /// Constructor initialized with ObjC wrapped object. + init(odwPrivacyConcernMetadataProvider: ODWPrivacyConcernMetadataProvider) { + self.odwPrivacyConcernMetadataProvider = odwPrivacyConcernMetadataProvider + } + + /// Default constructor. + public init() { + odwPrivacyConcernMetadataProvider = ODWPrivacyConcernMetadataProvider() + } + + /// Get the database name for the provided record. + public func getDatabaseName(for record: Any) -> String { + return odwPrivacyConcernMetadataProvider.getDatabaseNameForRecord(record) + } + + /// Get the server name for the provided record. + public func getServerName(for record: Any) -> String { + return odwPrivacyConcernMetadataProvider.getServerNameForRecord(record) + } + + /// Get the event locator name for the provided record. + public func getEventLocatorName(for record: Any) -> String { + return odwPrivacyConcernMetadataProvider.getEventLocatorNameForRecord(record) + } + + /// Get the event locator value for the provided record. + public func getEventLocatorValue(for record: Any) -> String { + return odwPrivacyConcernMetadataProvider.getEventLocatorValueForRecord(record) + } + + /// Get the override for the privacy guard event time for the provided record. + public func getPrivacyGuardEventTimeOverride(for record: Any) -> Int64 { + return odwPrivacyConcernMetadataProvider.getPrivacyGuardEventTimeOverrideForRecord(record) + } + + /// Check if the record should be ignored. + public func getShouldIgnoreOverride(for record: Any) -> Bool { + return odwPrivacyConcernMetadataProvider.getShouldIgnoreOverrideForRecord(record) + } + + /// Get the associated tenant for the provided record. + public func getAssociatedTenant(for record: Any) -> String { + return odwPrivacyConcernMetadataProvider.getAssociatedTenantForRecord(record) + } + + /// Get the environment for the provided record. + public func getEnvironment(for record: Any) -> String { + return odwPrivacyConcernMetadataProvider.getEnvironmentForRecord(record) + } + + /// Get the metadata for the provided record. + public func getMetadata(for record: Any) -> String { + return odwPrivacyConcernMetadataProvider.getMetadataForRecord(record) + } +} diff --git a/wrappers/swift/Sources/OneDSSwift/PrivacyGuardInitConfig.swift b/wrappers/swift/Sources/OneDSSwift/PrivacyGuardInitConfig.swift index 7f660d9f6..4bd77f974 100644 --- a/wrappers/swift/Sources/OneDSSwift/PrivacyGuardInitConfig.swift +++ b/wrappers/swift/Sources/OneDSSwift/PrivacyGuardInitConfig.swift @@ -8,7 +8,7 @@ import ObjCModule public final class PrivacyGuardInitConfig { let odwPrivacyGuardInitConfig: ODWPrivacyGuardInitConfig private var commonDataContext: CommonDataContext - + private var privacyConcernMetadataProvider: PrivacyConcernMetadataProvider /// Data Context to use with the Privacy Guard. public var dataContext: CommonDataContext { get { @@ -20,6 +20,17 @@ public final class PrivacyGuardInitConfig { } } + /// Metadata provider to use with Privacy Guard. + public var metadataProvider: PrivacyConcernMetadataProvider { + get { + return metadataProvider + } + set { + metadataProvider = newValue + odwPrivacyGuardInitConfig.metadataProvider = privacyConcernMetadataProvider.odwPrivacyConcernMetadataProvider + } + } + /// (OPTIONAL) Custom event name to use when logging privacy concerns. Default value is `PrivacyConcern`. public var notificationEventName: String { get { @@ -84,6 +95,8 @@ public final class PrivacyGuardInitConfig { public init() { odwPrivacyGuardInitConfig = ODWPrivacyGuardInitConfig() odwPrivacyGuardInitConfig.dataContext = ODWCommonDataContext() + odwPrivacyGuardInitConfig.metadataProvider = ODWPrivacyConcernMetadataProvider() + metadataProvider = PrivacyConcernMetadataProvider(odwPrivacyConcernMetadataProvider: odwPrivacyGuardInitConfig.metadataProvider) commonDataContext = CommonDataContext(odwCommonDataContext: odwPrivacyGuardInitConfig.dataContext) }