diff --git a/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs b/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs index 7c6c738a7..00204eea4 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/RoleFilter.cs @@ -4,10 +4,7 @@ namespace BotSharp.Abstraction.Repositories.Filters; public class RoleFilter { - [JsonPropertyName("names")] public IEnumerable? Names { get; set; } - - [JsonPropertyName("exclude_roles")] public IEnumerable? ExcludeRoles { get; set; } = UserConstant.AdminRoles; diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/User/RoleController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/User/RoleController.cs index 7b356f930..9ab93df47 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/User/RoleController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/User/RoleController.cs @@ -36,8 +36,8 @@ public async Task> GetRoleOptions() } [BotSharpAuth] - [HttpPost("/roles")] - public async Task> GetRoles([FromBody] RoleFilter? filter = null) + [HttpGet("/roles")] + public async Task> GetRoles([FromQuery] RoleFilter? filter = null) { if (filter == null) { diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/SignalRHub.cs b/src/Plugins/BotSharp.Plugin.ChatHub/SignalRHub.cs index a261084bb..d39ed7152 100644 --- a/src/Plugins/BotSharp.Plugin.ChatHub/SignalRHub.cs +++ b/src/Plugins/BotSharp.Plugin.ChatHub/SignalRHub.cs @@ -12,7 +12,8 @@ public class SignalRHub : Hub private readonly IUserIdentity _user; private readonly IHttpContextAccessor _context; - public SignalRHub(IServiceProvider services, + public SignalRHub( + IServiceProvider services, ILogger logger, IUserIdentity user, IHttpContextAccessor context) @@ -25,15 +26,16 @@ public SignalRHub(IServiceProvider services, public override async Task OnConnectedAsync() { - _logger.LogInformation($"SignalR Hub: {_user.FirstName} {_user.LastName} ({Context.User.Identity.Name}) connected in {Context.ConnectionId}"); - var convService = _services.GetRequiredService(); - var httpContext = Context.GetHttpContext(); + var httpContext = Context?.GetHttpContext(); + + _logger.LogInformation($"SignalR Hub: {_user?.FirstName} {_user?.LastName} ({Context?.User?.Identity?.Name ?? "Unkown user"}) connected in {Context?.ConnectionId}"); + string? conversationId = httpContext?.Request?.Query["conversation-id"].FirstOrDefault(); if (!string.IsNullOrEmpty(conversationId)) { - _logger.LogInformation($"Connection {Context.ConnectionId} is with conversation {conversationId}"); + _logger.LogInformation($"Connection {Context?.ConnectionId} is with conversation {conversationId}"); await AddGroup(conversationId); var conv = await convService.GetConversation(conversationId);