namespace ZB.MOM.WW.OtOpcUa.Admin.Security;
/// A cluster-scoped Admin-role grant — the binds only within .
public sealed record ClusterRoleGrant(string ClusterId, string Role);
///
/// The Admin roles a user holds after sign-in, split by scope. apply
/// across every cluster; each entry in binds only within its named
/// cluster. Resolved by from the user's LDAP groups.
///
public sealed record AdminRoleGrants(
IReadOnlyList FleetRoles,
IReadOnlyList ClusterRoles)
{
/// No grants — sign-in is blocked when a resolution yields this.
public static readonly AdminRoleGrants Empty = new([], []);
/// True when the user holds no Admin role at any scope.
public bool IsEmpty => FleetRoles.Count == 0 && ClusterRoles.Count == 0;
}
///
/// Resolves the Admin-role grants a set of LDAP groups confers. Augments the static
/// bootstrap dictionary (always fleet-wide) with the
/// DB-backed LdapGroupRoleMapping rows authored on the role-grants page — fleet-wide
/// and cluster-scoped. The static dictionary is the lock-out-proof fallback; DB grants stack
/// additively on top of it.
///
public interface IAdminRoleGrantResolver
{
Task ResolveAsync(IReadOnlyList ldapGroups, CancellationToken cancellationToken);
}