using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
using ZB.MOM.WW.OtOpcUa.Configuration.Services;
namespace ZB.MOM.WW.OtOpcUa.Security.Ldap;
///
/// Driver-only-node stand-in for the EF-backed .
/// A driver-only node (Akka role driver, not admin) has no ConfigDb connection
/// (Phase 4 gated AddOtOpcUaConfigDb on hasAdmin), so it can never read the
/// control-plane LdapGroupRoleMapping DB grants that
/// normally unions into its result. This implementation always reports "no DB grants" so the
/// data-path mapper falls back to exactly the appsettings Security:Ldap:GroupToRole
/// baseline — the same safe fallback the mapper already takes when the real service simply
/// has no matching rows. rows are not composed into the
/// deployment artifact either, so a driver node never had DB grants via config; reporting
/// empty here is honest, not lossy.
///
///
/// The write surface (/) is control-plane-only
/// Admin UI functionality that a driver-only node — which has no Admin UI — never calls. It
/// throws rather than silently no-opping so an accidental call surfaces immediately instead of
/// pretending to persist a grant that a driver-only node cannot store.
///
public sealed class NullLdapGroupRoleMappingService : ILdapGroupRoleMappingService
{
///
public Task> GetByGroupsAsync(
IEnumerable ldapGroups, CancellationToken cancellationToken)
=> Task.FromResult>(Array.Empty());
///
public Task> ListAllAsync(CancellationToken cancellationToken)
=> Task.FromResult>(Array.Empty());
///
public Task CreateAsync(LdapGroupRoleMapping row, CancellationToken cancellationToken)
=> throw new NotSupportedException(
"LDAP group-role grants are control-plane only; a driver-only node has no ConfigDb.");
///
public Task DeleteAsync(Guid id, CancellationToken cancellationToken)
=> throw new NotSupportedException(
"LDAP group-role grants are control-plane only; a driver-only node has no ConfigDb.");
}