Changed sender parameter to channel.
This commit is contained in:
@@ -17,7 +17,7 @@ namespace HermesSocketServer.Requests
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
|
||||
public async Task<RequestResult> Grant(Channel channel, IDictionary<string, object> data)
|
||||
{
|
||||
var id = Guid.Parse(data["id"].ToString()!);
|
||||
string groupId = data["groupId"].ToString()!;
|
||||
@@ -25,11 +25,10 @@ namespace HermesSocketServer.Requests
|
||||
int count = int.Parse(data["count"].ToString()!);
|
||||
int span = int.Parse(data["span"].ToString()!);
|
||||
|
||||
var channel = _channels.Get(sender)!;
|
||||
bool result = channel.Policies.Set(id.ToString(), new PolicyMessage()
|
||||
{
|
||||
Id = id,
|
||||
UserId = sender,
|
||||
UserId = channel.Id,
|
||||
GroupId = Guid.Parse(groupId),
|
||||
Path = path,
|
||||
Usage = count,
|
||||
@@ -39,7 +38,7 @@ namespace HermesSocketServer.Requests
|
||||
if (result)
|
||||
{
|
||||
var policy = channel.Policies.Get(id.ToString());
|
||||
_logger.Information($"Updated policy to channel [policy id: {id}][group id: {groupId}][path: {path}][count: {count}][span: {span}][channel: {sender}]");
|
||||
_logger.Information($"Updated policy to channel [policy id: {id}][group id: {groupId}][path: {path}][count: {count}][span: {span}][channel: {channel.Id}]");
|
||||
return RequestResult.Successful(policy);
|
||||
}
|
||||
return RequestResult.Failed("Something went wrong when updating the cache.");
|
||||
|
||||
Reference in New Issue
Block a user