feat: admin users can view all downloads with user badges
- Admin users (Emby IsAdministrator) see a 'Show all users' toggle - When toggled, all tagged downloads are shown regardless of user - Each download card shows the tagged user's name as a badge - Non-admin users see only their own downloads (unchanged behavior) - Backend accepts ?showAll=true query param (admin-only)
This commit is contained in:
@@ -37,9 +37,11 @@ router.post('/login', async (req, res) => {
|
||||
console.log(`[Auth] Login successful for user: ${user.Name}`);
|
||||
|
||||
// Set authentication cookie
|
||||
const isAdmin = !!(user.Policy && user.Policy.IsAdministrator);
|
||||
res.cookie('emby_user', JSON.stringify({
|
||||
id: user.Id,
|
||||
name: user.Name,
|
||||
isAdmin: isAdmin,
|
||||
token: authData.AccessToken
|
||||
}), {
|
||||
httpOnly: true,
|
||||
@@ -50,7 +52,8 @@ router.post('/login', async (req, res) => {
|
||||
success: true,
|
||||
user: {
|
||||
id: user.Id,
|
||||
name: user.Name
|
||||
name: user.Name,
|
||||
isAdmin: isAdmin
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -76,7 +79,8 @@ router.get('/me', (req, res) => {
|
||||
authenticated: true,
|
||||
user: {
|
||||
id: user.id,
|
||||
name: user.name
|
||||
name: user.name,
|
||||
isAdmin: !!user.isAdmin
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user