feat: Schocken - Testmodus Spieler-Switcher für Admin
This commit is contained in:
@@ -102,7 +102,15 @@ function sendPush(userId, title, message) {
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
const uid = req => req.user.id;
|
||||
const uid = req => {
|
||||
// Testmodus: Admin kann als anderen User agieren
|
||||
const testAs = req.headers['x-schocken-test-as'];
|
||||
if (testAs && req.user?.role === 'admin') {
|
||||
const testId = parseInt(testAs);
|
||||
if (!isNaN(testId)) return testId;
|
||||
}
|
||||
return req.user.id;
|
||||
};
|
||||
|
||||
// ── Alle Spiele des Users ─────────────────────────────────────────────────────
|
||||
router.get('/', authenticate, (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user