aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Messaging/API/Controllers
diff options
context:
space:
mode:
authorSanskar Pandey <sanskarpandey0@gmail.com>2022-10-07 04:05:06 +0530
committerGitHub <noreply@github.com>2022-10-07 04:05:06 +0530
commit9fc05648a75b1c8022e3f034ff2abca47cdeaaf2 (patch)
treee684ac785f9458fae25c219f44eb03031984d9f4 /src/slskd/Messaging/API/Controllers
parent94d2536da26287e696662c82295c2fdc832ec856 (diff)
parentfb6350e107bd5f850a13c8c2065e341241967ab2 (diff)
downloadslskd-9fc05648a75b1c8022e3f034ff2abca47cdeaaf2.tar.gz
Merge branch 'master' into mutex-implementation
Diffstat (limited to 'src/slskd/Messaging/API/Controllers')
-rw-r--r--src/slskd/Messaging/API/Controllers/ConversationsController.cs12
-rw-r--r--src/slskd/Messaging/API/Controllers/PublicChatController.cs4
-rw-r--r--src/slskd/Messaging/API/Controllers/RoomsController.cs20
3 files changed, 18 insertions, 18 deletions
diff --git a/src/slskd/Messaging/API/Controllers/ConversationsController.cs b/src/slskd/Messaging/API/Controllers/ConversationsController.cs
index 492340f0..17c55a10 100644
--- a/src/slskd/Messaging/API/Controllers/ConversationsController.cs
+++ b/src/slskd/Messaging/API/Controllers/ConversationsController.cs
@@ -66,7 +66,7 @@ namespace slskd.Messaging.API
/// A conversation with the specified username, or a message matching the specified id could not be found.
/// </response>
[HttpPut("{username}/{id}")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(200)]
[ProducesResponseType(404)]
public async Task<IActionResult> Acknowledge([FromRoute]string username, [FromRoute]int id)
@@ -90,7 +90,7 @@ namespace slskd.Messaging.API
/// <response code="200">The request completed successfully.</response>
/// <response code="404">A conversation with the specified username could not be found.</response>
[HttpPut("{username}")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(200)]
[ProducesResponseType(404)]
public async Task<IActionResult> AcknowledgeAll([FromRoute]string username)
@@ -124,7 +124,7 @@ namespace slskd.Messaging.API
/// <response code="204">The request completed successfully.</response>
/// <response code="404">A conversation with the specified username could not be found.</response>
[HttpDelete("{username}")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(404)]
[ProducesResponseType(204)]
public IActionResult Delete([FromRoute]string username)
@@ -145,7 +145,7 @@ namespace slskd.Messaging.API
/// <returns></returns>
/// <response code="200">The request completed successfully.</response>
[HttpGet("")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(Dictionary<string, List<PrivateMessageResponse>>), 200)]
public IActionResult GetAll()
{
@@ -166,7 +166,7 @@ namespace slskd.Messaging.API
/// <response code="200">The request completed successfully.</response>
/// <response code="404">A matching search was not found.</response>
[HttpGet("{username}")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(List<PrivateMessageResponse>), 200)]
[ProducesResponseType(404)]
public IActionResult GetByUsername([FromRoute]string username)
@@ -192,7 +192,7 @@ namespace slskd.Messaging.API
/// <response code="201">The request completed successfully.</response>
/// <response code="400">The specified message is null or empty.</response>
[HttpPost("{username}")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(201)]
[ProducesResponseType(400)]
public async Task<IActionResult> Send([FromRoute]string username, [FromBody]string message)
diff --git a/src/slskd/Messaging/API/Controllers/PublicChatController.cs b/src/slskd/Messaging/API/Controllers/PublicChatController.cs
index c30e08a8..83f7ede7 100644
--- a/src/slskd/Messaging/API/Controllers/PublicChatController.cs
+++ b/src/slskd/Messaging/API/Controllers/PublicChatController.cs
@@ -45,7 +45,7 @@ namespace slskd.Messaging.API
/// </summary>
/// <returns></returns>
[HttpPost]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
public async Task<IActionResult> Start()
{
await Client.StartPublicChatAsync();
@@ -57,7 +57,7 @@ namespace slskd.Messaging.API
/// </summary>
/// <returns></returns>
[HttpDelete]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
public async Task<IActionResult> Stop()
{
await Client.StopPublicChatAsync();
diff --git a/src/slskd/Messaging/API/Controllers/RoomsController.cs b/src/slskd/Messaging/API/Controllers/RoomsController.cs
index 8a3e5f3f..66993630 100644
--- a/src/slskd/Messaging/API/Controllers/RoomsController.cs
+++ b/src/slskd/Messaging/API/Controllers/RoomsController.cs
@@ -59,7 +59,7 @@ namespace slskd.Messaging.API
/// <returns></returns>
/// <response code="200">The request completed successfully.</response>
[HttpGet("joined")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(Dictionary<string, Dictionary<string, Room>>), 200)]
public IActionResult GetAll()
{
@@ -74,7 +74,7 @@ namespace slskd.Messaging.API
/// <response code="200">The request completed successfully.</response>
/// <response code="404">The specified roomName could not be found.</response>
[HttpGet("joined/{roomName}")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(Room), 200)]
[ProducesResponseType(404)]
public IActionResult GetByRoomName([FromRoute]string roomName)
@@ -96,7 +96,7 @@ namespace slskd.Messaging.API
/// <response code="201">The request completed successfully.</response>
/// <response code="404">The specified roomName could not be found.</response>
[HttpPost("joined/{roomName}/messages")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(201)]
[ProducesResponseType(404)]
public async Task<IActionResult> SendMessage([FromRoute]string roomName, [FromBody]string message)
@@ -119,7 +119,7 @@ namespace slskd.Messaging.API
/// <response code="201">The request completed successfully.</response>
/// <response code="404">The specified roomName could not be found.</response>
[HttpPost("joined/{roomName}/ticker")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(201)]
[ProducesResponseType(404)]
public async Task<IActionResult> SetTicker([FromRoute] string roomName, [FromBody] string message)
@@ -142,7 +142,7 @@ namespace slskd.Messaging.API
/// <response code="201">The request completed successfully.</response>
/// <response code="404">The specified roomName could not be found.</response>
[HttpPost("joined/{roomName}/members")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(201)]
[ProducesResponseType(404)]
public async Task<IActionResult> AddRoomMember([FromRoute]string roomName, [FromBody]string username)
@@ -164,7 +164,7 @@ namespace slskd.Messaging.API
/// <response code="200">The request completed successfully.</response>
/// <response code="404">The specified roomName could not be found.</response>
[HttpGet("joined/{roomName}/users")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(IList<UserData>), 200)]
[ProducesResponseType(404)]
public IActionResult GetUsersByRoomName([FromRoute]string roomName)
@@ -188,7 +188,7 @@ namespace slskd.Messaging.API
/// <response code="200">The request completed successfully.</response>
/// <response code="404">The specified roomName could not be found.</response>
[HttpGet("joined/{roomName}/messages")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(IList<RoomMessage>), 200)]
[ProducesResponseType(404)]
public IActionResult GetMessagesByRoomName([FromRoute]string roomName)
@@ -209,7 +209,7 @@ namespace slskd.Messaging.API
/// </summary>
/// <returns></returns>
[HttpGet("available")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(List<RoomInfo>), 200)]
public async Task<IActionResult> GetRooms()
{
@@ -237,7 +237,7 @@ namespace slskd.Messaging.API
/// <response code="201">The request completed successfully.</response>
/// <response code="304">The room has already been joined.</response>
[HttpPost("joined")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(typeof(Room), 201)]
[ProducesResponseType(304)]
public async Task<IActionResult> JoinRoom([FromBody]string roomName)
@@ -273,7 +273,7 @@ namespace slskd.Messaging.API
/// <response code="204">The request completed successfully.</response>
/// <response code="404">The room has not been joined.</response>
[HttpDelete("joined/{roomName}")]
- [Authorize]
+ [Authorize(Policy = AuthPolicy.Any)]
[ProducesResponseType(204)]
[ProducesResponseType(404)]
public async Task<IActionResult> LeaveRoom([FromRoute]string roomName)