diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-28 19:13:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-28 19:13:25 -0500 |
| commit | 2e127575c5231ea94a2f327084c5da29b8a9e895 (patch) | |
| tree | c155815345acac601326890d66d0ea8faf29fce3 /src/slskd/Messaging/API/Controllers | |
| parent | 47c0c9fccbe976c1d1f8f71c6b0bfd45bceda1a4 (diff) | |
| parent | 2b827344d11e7490b323defa898264cadbdb6089 (diff) | |
| download | slskd-2e127575c5231ea94a2f327084c5da29b8a9e895.tar.gz | |
Merge branch 'master' into bugs
Diffstat (limited to 'src/slskd/Messaging/API/Controllers')
| -rw-r--r-- | src/slskd/Messaging/API/Controllers/ConversationsController.cs | 14 | ||||
| -rw-r--r-- | src/slskd/Messaging/API/Controllers/RoomsController.cs | 10 |
2 files changed, 12 insertions, 12 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) diff --git a/src/slskd/Messaging/API/Controllers/RoomsController.cs b/src/slskd/Messaging/API/Controllers/RoomsController.cs index 3b2fe568..57d3b742 100644 --- a/src/slskd/Messaging/API/Controllers/RoomsController.cs +++ b/src/slskd/Messaging/API/Controllers/RoomsController.cs @@ -127,7 +127,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(201)] [ProducesResponseType(404)] public async Task<IActionResult> SendMessage([FromRoute, UrlEncoded] string roomName, [FromBody] string message) @@ -155,7 +155,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(201)] [ProducesResponseType(404)] public async Task<IActionResult> SetTicker([FromRoute, UrlEncoded] string roomName, [FromBody] string message) @@ -183,7 +183,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(201)] [ProducesResponseType(404)] public async Task<IActionResult> AddRoomMember([FromRoute, UrlEncoded] string roomName, [FromBody] string username) @@ -298,7 +298,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(typeof(Room), 201)] [ProducesResponseType(304)] public async Task<IActionResult> JoinRoom([FromBody] string roomName) @@ -339,7 +339,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(Policy = AuthPolicy.Any)] + [Authorize(Policy = AuthPolicy.Any, Roles = AuthRole.ReadWriteOrAdministrator)] [ProducesResponseType(204)] [ProducesResponseType(404)] public async Task<IActionResult> LeaveRoom([FromRoute, UrlEncoded] string roomName) |
