using HermesSocketServer.Services; using ILogger = Serilog.ILogger; namespace HermesSocketServer.Requests { public class GetPolicies : IRequest { public string Name => "get_policies"; public string[] RequiredKeys => []; private ChannelManager _channels; private ILogger _logger; public GetPolicies(ChannelManager channels, ILogger logger) { _channels = channels; _logger = logger; } public async Task Grant(string sender, IDictionary? data) { var channel = _channels.Get(sender); var results = channel.Policies.Get().Values; _logger.Information($"Fetched policies for channel [policy size: {results.Count}][channel: {sender}]"); return RequestResult.Successful(results, notifyClientsOnAccount: false); } } }