using Microsoft.Extensions.Options;
using ZB.MOM.WW.Auth.Abstractions.Roles;
using ZB.MOM.WW.MxGateway.Server.Configuration;
namespace ZB.MOM.WW.MxGateway.Server.Dashboard;
///
/// Shared-Auth seam over the dashboard's
/// LDAP-group → role mapping. Roles are plain strings
/// ( / ),
/// so TRole is . The mapping rules (full-DN first,
/// leading-RDN fallback, case-insensitive) live in
/// , shared with
/// so behaviour stays identical.
///
/// Gateway options supplying the dashboard GroupToRole map.
public sealed class DashboardGroupRoleMapper(IOptions options)
: IGroupRoleMapper
{
///
public Task> MapAsync(
IReadOnlyList groups,
CancellationToken ct)
{
IReadOnlyList roles = DashboardGroupRoleMapping.MapGroupsToRoles(
groups,
options.Value.Dashboard.GroupToRole);
return Task.FromResult(new GroupRoleMapping(roles, Scope: null));
}
}