rewriting routs
This commit is contained in:
@@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
namespace LightlessSyncAuthService.Controllers;
|
||||
|
||||
[Route(LightlessAuth.User)]
|
||||
[Authorize(Policy = "Internal")]
|
||||
public class UserController : Controller
|
||||
{
|
||||
protected readonly ILogger Logger;
|
||||
@@ -17,8 +18,8 @@ public class UserController : Controller
|
||||
LightlessDbContextFactory = lightlessDbContext;
|
||||
}
|
||||
|
||||
[Authorize(Policy = "Internal")]
|
||||
[HttpPost(LightlessAuth.Ban_Uid)]
|
||||
[Route(LightlessAuth.Ban_Uid)]
|
||||
[HttpPost]
|
||||
public async Task MarkForBanUid(string uid)
|
||||
{
|
||||
using var dbContext = await LightlessDbContextFactory.CreateDbContextAsync();
|
||||
@@ -35,8 +36,8 @@ public class UserController : Controller
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
[Authorize(Policy = "Internal")]
|
||||
[HttpPost(LightlessAuth.User_Unban_Uid)]
|
||||
[Route(LightlessAuth.User_Unban_Uid)]
|
||||
[HttpPost]
|
||||
public async Task UnBanUserByUid(string uid)
|
||||
{
|
||||
using var dbContext = await LightlessDbContextFactory.CreateDbContextAsync();
|
||||
@@ -66,8 +67,8 @@ public class UserController : Controller
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
[Authorize(Policy = "Internal")]
|
||||
[HttpPost(LightlessAuth.User_Unban_Discord)]
|
||||
[Route(LightlessAuth.User_Unban_Discord)]
|
||||
[HttpPost]
|
||||
public async Task UnBanUserByDiscordId(string discordId)
|
||||
{
|
||||
Logger.LogInformation("Unbanning user with discordId: {discordId}", discordId);
|
||||
|
||||
@@ -106,7 +106,9 @@ public class LightlessModule : InteractionModuleBase
|
||||
using HttpClient c = new HttpClient();
|
||||
|
||||
c.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _serverTokenGenerator.Token);
|
||||
|
||||
var testUri = new Uri(_lightlessServicesConfiguration.GetValue<Uri>
|
||||
(nameof(ServicesConfiguration.MainServerAddress)), "/msgc/sendMessage");
|
||||
_logger.LogInformation("UnbanByDiscord:URI:{uri}", testUri);
|
||||
await c.PostAsJsonAsync(
|
||||
new Uri(_lightlessServicesConfiguration.GetValue<Uri>(nameof(ServicesConfiguration.MainServerAddress)), "/msgc/sendMessage"),
|
||||
new ClientMessage(messageType, message, uid ?? string.Empty)
|
||||
@@ -152,6 +154,7 @@ public class LightlessModule : InteractionModuleBase
|
||||
try
|
||||
{
|
||||
using HttpClient c = new HttpClient();
|
||||
|
||||
c.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _serverTokenGenerator.Token);
|
||||
await c.PostAsJsonAsync(new Uri(_lightlessServicesConfiguration.GetValue<Uri>
|
||||
(nameof(ServicesConfiguration.MainServerAddress)), "/user/unbanDiscord"), new { discordId })
|
||||
@@ -193,6 +196,9 @@ public class LightlessModule : InteractionModuleBase
|
||||
try
|
||||
{
|
||||
using HttpClient c = new HttpClient();
|
||||
var testUri = new Uri(_lightlessServicesConfiguration.GetValue<Uri>
|
||||
(nameof(ServicesConfiguration.MainServerAddress)), "/user/unbanDiscord");
|
||||
_logger.LogInformation("UnbanByDiscord:URI:{uri}", testUri);
|
||||
c.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _serverTokenGenerator.Token);
|
||||
await c.PostAsJsonAsync(new Uri(_lightlessServicesConfiguration.GetValue<Uri>
|
||||
(nameof(ServicesConfiguration.MainServerAddress)), "/user/unbanUID"), new { uid })
|
||||
@@ -234,6 +240,7 @@ public class LightlessModule : InteractionModuleBase
|
||||
try
|
||||
{
|
||||
using HttpClient c = new HttpClient();
|
||||
|
||||
c.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _serverTokenGenerator.Token);
|
||||
await c.PostAsJsonAsync(new Uri(_lightlessServicesConfiguration.GetValue<Uri>
|
||||
(nameof(ServicesConfiguration.MainServerAddress)), "/user/ban"), new { uid })
|
||||
|
||||
Reference in New Issue
Block a user