audiobookshelf/server/models
zriddle 464b720d9e Add canStream user permission to control streaming access
Adds a per-user "Can Stream" permission mirroring the existing "Can Download"
pattern. Server admins can now disable streaming for specific users, encouraging
local downloads instead. Addresses #2572.

Changes:
- User model: stream permission in mapping, defaults, and getter
- ApiKey model: stream permission in defaults
- Controller: 403 enforcement on playback session creation endpoints
- Frontend: permission toggle in admin UI, play button gated by canStream,
  download button shown when streaming disabled, message when neither allowed
- Tests: 11 Mocha tests (model + controller), 1 Cypress test (card UI)
- Localization: English strings for toggle label and fallback message

The getter uses !== false (rather than !!) so existing users without the
stream key in their permissions JSON default to allowed on upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 14:12:08 -06:00
..
ApiKey.js Add canStream user permission to control streaming access 2026-04-02 14:12:08 -06:00
Author.js Update JS docs 2026-03-30 16:22:27 -05:00
Book.js Emit proper author_updated/added events when updating book media 2026-03-30 22:02:56 +03:00
BookAuthor.js Add: migrations for authors, series, and podcast episodes 2024-10-19 10:40:17 -07:00
BookSeries.js Add indexes to MediaProgress and BookSeries models 2026-03-12 16:37:59 -05:00
Collection.js Update controllers to use toOldJSON functions 2025-01-04 15:20:41 -06:00
CollectionBook.js Refactor Collection model/controller to not use old Collection object, remove 2024-12-30 16:54:48 -06:00
CustomMetadataProvider.js Clean out old unused functions, Device updates for replacing DeviceInfo 2024-09-12 16:36:39 -05:00
Device.js Clean out old unused functions, Device updates for replacing DeviceInfo 2024-09-12 16:36:39 -05:00
Feed.js Update feedepisode psc customElement 2025-03-31 17:59:16 -05:00
FeedEpisode.js prettier 2025-04-26 17:46:19 +02:00
Library.js Fix:Server crash deleting library that has playback sessions #3634 2024-11-22 17:20:31 -06:00
LibraryFolder.js Updates to LibraryController to use new Library model 2024-08-24 15:38:15 -05:00
LibraryItem.js Speed up personalized shelves and reduce search payload size 2026-02-19 20:11:38 -05:00
MediaItemShare.js Migrate to new library item in scanner 2025-01-05 12:05:01 -06:00
MediaProgress.js Add indexes to MediaProgress and BookSeries models 2026-03-12 16:37:59 -05:00
PlaybackSession.js Update uuid migration to v2.17.0 and for all tables still using UUIDv4 2024-11-17 15:45:21 -06:00
Playlist.js Update controllers to use toOldJSON functions 2025-01-04 15:20:41 -06:00
PlaylistMediaItem.js Fix find all playlist endpoint 2024-12-31 17:11:31 -06:00
Podcast.js Fix podcast itunesId not set on create or update from match #4614 2025-08-22 08:20:49 -05:00
PodcastEpisode.js Fix podcast episode track index null in playback session 2025-07-22 14:44:36 -05:00
Series.js Migrate to new library item in scanner 2025-01-05 12:05:01 -06:00
Session.js Implement new JWT auth 2025-06-29 17:22:58 -05:00
Setting.js Remove unused functions, jsdoc updates, auto-formatting 2024-05-28 17:24:02 -05:00
User.js Add canStream user permission to control streaming access 2026-04-02 14:12:08 -06:00