using ZB.MOM.WW.OtOpcUa.Configuration.Entities; using ZB.MOM.WW.OtOpcUa.Configuration.Enums; namespace ZB.MOM.WW.OtOpcUa.Configuration.Services; /// /// CRUD surface for — the control-plane mapping from /// LDAP groups to Admin UI roles. Consumed only by Admin UI code paths; the OPC UA /// data-path evaluator MUST NOT depend on this interface (see decision #150 and the /// Phase 6.2 compliance check on control/data-plane separation). /// /// /// Per Phase 6.2 Stream A.2 this service is expected to run behind the Phase 6.1 /// ResilientConfigReader pipeline (timeout → retry → fallback-to-cache) so a /// transient DB outage during sign-in falls back to the sealed snapshot rather than /// denying every login. /// public interface ILdapGroupRoleMappingService { /// List every mapping whose LDAP group matches one of . /// /// Hot path — fires on every sign-in. The default EF implementation relies on the /// IX_LdapGroupRoleMapping_Group index. The match is a SQL IN (…) whose /// case-sensitivity is determined by the LdapGroup column collation. Case-insensitive /// behaviour requires a case-insensitive (CI) server or column collation — this is a /// deployment requirement. On a case-sensitive-collation server the lookup will silently /// miss rows that differ only in case. /// /// The LDAP groups to search for. /// The cancellation token. Task> GetByGroupsAsync( IEnumerable ldapGroups, CancellationToken cancellationToken); /// Enumerate every mapping; Admin UI listing only. /// The cancellation token. Task> ListAllAsync(CancellationToken cancellationToken); /// Create a new grant. /// /// Thrown when the proposed row violates an invariant (IsSystemWide inconsistent with /// ClusterId, duplicate (group, cluster) pair, etc.) — ValidatedLdapGroupRoleMappingService /// is the write surface that enforces these; the raw service here surfaces DB-level violations. /// /// The LDAP group role mapping to create. /// The cancellation token. Task CreateAsync(LdapGroupRoleMapping row, CancellationToken cancellationToken); /// Delete a mapping by its surrogate key. /// The unique identifier of the mapping to delete. /// The cancellation token. Task DeleteAsync(Guid id, CancellationToken cancellationToken); } /// Thrown when authoring violates an invariant. public sealed class InvalidLdapGroupRoleMappingException : Exception { /// Initializes a new instance of the InvalidLdapGroupRoleMappingException. /// The error message. public InvalidLdapGroupRoleMappingException(string message) : base(message) { } }