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 { /// Maps the supplied dashboard LDAP group memberships to a dashboard role. /// The user's directory group memberships. /// A token to request cancellation of the operation. /// The dashboard roles granted; scope is unused and always . public Task> MapAsync( IReadOnlyList groups, CancellationToken ct) { IReadOnlyList roles = DashboardGroupRoleMapping.MapGroupsToRoles( groups, options.Value.Dashboard.GroupToRole); return Task.FromResult(new GroupRoleMapping(roles, Scope: null)); } }