25 lines
770 B
C#
25 lines
770 B
C#
using HermesSocketServer.Models;
|
|
using ILogger = Serilog.ILogger;
|
|
|
|
namespace HermesSocketServer.Requests
|
|
{
|
|
public class GetPolicies : IRequest
|
|
{
|
|
public string Name => "get_policies";
|
|
public string[] RequiredKeys => [];
|
|
private ILogger _logger;
|
|
|
|
public GetPolicies(ILogger logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
|
{
|
|
var results = channel.Policies.Get().Values;
|
|
|
|
_logger.Information($"Fetched policies for channel [policy size: {results.Count}][channel: {channel.Id}]");
|
|
return Task.FromResult(RequestResult.Successful(results, notifyClientsOnAccount: false));
|
|
}
|
|
}
|
|
} |