using ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections; using ZB.MOM.WW.OtOpcUa.Core.Authorization; namespace ZB.MOM.WW.OtOpcUa.Runtime.DataConnections; /// Internal deployment-scoped authority; never accepted from an SDK caller. internal sealed class ConfiguredProjectionCapability(string mappingId, long revision, DataRealm realm, DataOperations operations, IDataMappedCatalogAuthority sourceAuthority, Func current) { internal string Nonce { get; } = Guid.NewGuid().ToString("N"); internal bool Matches(string mapping, DataView view, IDataMappedCatalogAuthority? authority) { try { return current() && sourceAuthority.IsActive && (operations & (DataOperations.Browse | DataOperations.Subscribe)) == (DataOperations.Browse | DataOperations.Subscribe) && string.Equals(mapping, mappingId, StringComparison.OrdinalIgnoreCase) && string.Equals(view.MappingId, mapping, StringComparison.OrdinalIgnoreCase) && view.MappingRevision == revision && view.Realm == realm && (authority is null || ReferenceEquals(authority, sourceAuthority)); } catch (Exception) { return false; } } }