[PR #4200] [MERGED] Fix socket events check user permissions for library items #4199 #4187

Closed
opened 2026-04-25 00:18:42 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4200
Author: @advplyr
Created: 4/13/2025
Status: Merged
Merged: 4/13/2025
Merged by: @advplyr

Base: masterHead: socket_item_events


📝 Commits (1)

  • bc1b99e Fix socket events check user permissions for library items #4199

📊 Changes

10 files changed (+69 additions, -61 deletions)

View changed files

📝 server/SocketAuthority.js (+36 -0)
📝 server/controllers/AuthorController.js (+2 -8)
📝 server/controllers/LibraryController.js (+2 -8)
📝 server/controllers/LibraryItemController.js (+9 -9)
📝 server/controllers/MiscController.js (+4 -4)
📝 server/controllers/PodcastController.js (+4 -4)
📝 server/managers/PodcastManager.js (+4 -4)
📝 server/scanner/LibraryItemScanner.js (+1 -1)
📝 server/scanner/LibraryScanner.js (+6 -22)
📝 server/scanner/Scanner.js (+1 -1)

📄 Description

Brief summary

Socket events sent out for item_updated, items_updated, item_added and items_added will check if user can access the library item before sending the event.

Which issue is fixed?

Fixed #4199

In-depth Description

This sets up 2 additional socket event emitters: libraryItemEmitter and libraryItemsEmitter

These emitters check the socket client users permission to access the library item before emitting. libraryItemsEmitter will filter out items not accessible.

How have you tested this?

Tested a user with tag restriction and checked for socket events while editing items.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4200 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 4/13/2025 **Status:** ✅ Merged **Merged:** 4/13/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `socket_item_events` --- ### 📝 Commits (1) - [`bc1b99e`](https://github.com/advplyr/audiobookshelf/commit/bc1b99efd6009d3eb006291ab11eb6cd6dee1f3e) Fix socket events check user permissions for library items #4199 ### 📊 Changes **10 files changed** (+69 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `server/SocketAuthority.js` (+36 -0) 📝 `server/controllers/AuthorController.js` (+2 -8) 📝 `server/controllers/LibraryController.js` (+2 -8) 📝 `server/controllers/LibraryItemController.js` (+9 -9) 📝 `server/controllers/MiscController.js` (+4 -4) 📝 `server/controllers/PodcastController.js` (+4 -4) 📝 `server/managers/PodcastManager.js` (+4 -4) 📝 `server/scanner/LibraryItemScanner.js` (+1 -1) 📝 `server/scanner/LibraryScanner.js` (+6 -22) 📝 `server/scanner/Scanner.js` (+1 -1) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary Socket events sent out for `item_updated`, `items_updated`, `item_added` and `items_added` will check if user can access the library item before sending the event. ## Which issue is fixed? Fixed #4199 ## In-depth Description This sets up 2 additional socket event emitters: `libraryItemEmitter` and `libraryItemsEmitter` These emitters check the socket client users permission to access the library item before emitting. `libraryItemsEmitter` will filter out items not accessible. ## How have you tested this? Tested a user with tag restriction and checked for socket events while editing items. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:18:42 +02:00
adam closed this issue 2026-04-25 00:18:42 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4187