mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 17:59:06 +02:00
New data model play media entity, PlaybackSessionManager
This commit is contained in:
parent
1cf9e85272
commit
099ae7c776
54 changed files with 841 additions and 902 deletions
|
@ -6,6 +6,26 @@ const { getId } = require('../utils/index')
|
|||
class UserController {
|
||||
constructor() { }
|
||||
|
||||
findAll(req, res) {
|
||||
if (!req.user.isRoot) return res.sendStatus(403)
|
||||
var users = this.db.users.map(u => this.userJsonWithItemProgressDetails(u))
|
||||
res.json(users)
|
||||
}
|
||||
|
||||
findOne(req, res) {
|
||||
if (!req.user.isRoot) {
|
||||
Logger.error('User other than root attempting to get user', req.user)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
var user = this.db.users.find(u => u.id === req.params.id)
|
||||
if (!user) {
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
|
||||
res.json(this.userJsonWithItemProgressDetails(user))
|
||||
}
|
||||
|
||||
async create(req, res) {
|
||||
if (!req.user.isRoot) {
|
||||
Logger.warn('Non-root user attempted to create user', req.user)
|
||||
|
@ -36,26 +56,6 @@ class UserController {
|
|||
}
|
||||
}
|
||||
|
||||
findAll(req, res) {
|
||||
if (!req.user.isRoot) return res.sendStatus(403)
|
||||
var users = this.db.users.map(u => this.userJsonWithBookProgressDetails(u))
|
||||
res.json(users)
|
||||
}
|
||||
|
||||
findOne(req, res) {
|
||||
if (!req.user.isRoot) {
|
||||
Logger.error('User other than root attempting to get user', req.user)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
var user = this.db.users.find(u => u.id === req.params.id)
|
||||
if (!user) {
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
|
||||
res.json(this.userJsonWithBookProgressDetails(user))
|
||||
}
|
||||
|
||||
async update(req, res) {
|
||||
if (!req.user.isRoot) {
|
||||
Logger.error('User other than root attempting to update user', req.user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue