diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-23 14:50:57 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-10-23 14:50:57 -0500 |
| commit | 3c34fcc3bde265d8c98792a8b7d00c61c4bd06e6 (patch) | |
| tree | 3d603bcac8e5471d8df85d23fc6a3d3c2835a2aa | |
| parent | e58f2e59adab312f9e18a13e00519783dca661ed (diff) | |
| download | slskd-3c34fcc3bde265d8c98792a8b7d00c61c4bd06e6.tar.gz | |
require r/w for conversations
| -rw-r--r-- | src/slskd/Messaging/API/Controllers/ConversationsController.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/slskd/Messaging/API/Controllers/ConversationsController.cs b/src/slskd/Messaging/API/Controllers/ConversationsController.cs index 7ed0a92c..a1c6038f 100644 --- a/src/slskd/Messaging/API/Controllers/ConversationsController.cs +++ b/src/slskd/Messaging/API/Controllers/ConversationsController.cs @@ -87,7 +87,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(200)] [ProducesResponseType(404)] public async Task<IActionResult> Acknowledge([FromRoute, UrlEncoded] string username, [FromRoute] int id) @@ -97,7 +97,7 @@ namespace slskd.Messaging.API return Forbid(); } - var message = Messages.Conversations.FindMessageAsync(username, id); + var message = await Messages.Conversations.FindMessageAsync(username, id); if (message == default) { @@ -117,7 +117,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(200)] [ProducesResponseType(404)] public async Task<IActionResult> AcknowledgeAll([FromRoute, UrlEncoded] string username) @@ -127,7 +127,7 @@ namespace slskd.Messaging.API return Forbid(); } - var conversation = Messages.Conversations.FindAsync(username); + var conversation = await Messages.Conversations.FindAsync(username); if (conversation == default) { @@ -146,7 +146,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(404)] [ProducesResponseType(204)] public async Task<IActionResult> Close([FromRoute, UrlEncoded] string username) @@ -156,7 +156,7 @@ namespace slskd.Messaging.API return Forbid(); } - var conversation = Messages.Conversations.FindAsync(username, includeInactive: false); + var conversation = await Messages.Conversations.FindAsync(username, includeInactive: false); if (conversation == default) { @@ -259,7 +259,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(201)] [ProducesResponseType(400)] public async Task<IActionResult> Send([FromRoute, UrlEncoded] string username, [FromBody] string message) |
