Portal: Admin-Panel, Rechnungsanalyse und alte Admin-Schnittstellen entfernt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3a4fa581c0
commit
7c00633db0
43 files changed
+229
-4001
No files matched your search
@@ -156,13 +156,16 @@ test('genau bei viewExpiresAt abgelaufen: 401, Cookies geloescht, Protokoll abge
|
||||
assert.deepEqual([expired.at(-1).customerId, expired.at(-1).staffName], ['c1', 'Andrej'])
|
||||
})
|
||||
|
||||
test('alte Ansicht aus admin.html (viewAsCookie, ohne viewId): Lesen ok, News anlegen 403, Logout ok', async () => {
|
||||
test('alte Ansicht ohne viewId (frueheres Admin-Panel): Lesen, Schreiben, Logout 401 view_expired, Cookies weg, kein Protokoll', async () => {
|
||||
const cookie = viewAsCookie('c1')
|
||||
assert.equal((await call('GET', '/api/news?projectId=p1', { cookie })).status, 200)
|
||||
const write = await call('POST', '/api/news', { cookie, body: note })
|
||||
assert.equal(write.status, 403)
|
||||
assert.equal(write.body.code, 'view_blocked')
|
||||
assert.equal((await call('POST', '/api/auth/logout', { cookie })).status, 200)
|
||||
const before = logEntries().length
|
||||
for (const [method, p, body] of [['GET', '/api/news?projectId=p1'], ['POST', '/api/news', note], ['POST', '/api/auth/logout']]) {
|
||||
const res = await call(method, p, { cookie, body })
|
||||
assert.equal(res.status, 401, `${method} ${p}`)
|
||||
assert.equal(res.body.code, 'view_expired', `${method} ${p}`)
|
||||
assert.ok(clears(res, config.cookieName), `${method} ${p}: Portal-Cookie geloescht`)
|
||||
}
|
||||
assert.equal(logEntries().length, before)
|
||||
})
|
||||
|
||||
test('normale Kunden-Sitzung wird nicht beruehrt (News anlegen 201 ohne Header)', async () => {
|
||||
@@ -192,18 +195,18 @@ test('Grossschreibung umgeht den Waechter nicht: /API/... wie /api/...', async (
|
||||
assert.equal(res.status, 403, `${method} ${upper}`)
|
||||
}
|
||||
const legacy = await call('POST', '/API/news', { cookie: viewAsCookie('c1'), body: note })
|
||||
assert.equal(legacy.status, 403)
|
||||
assert.equal(legacy.status, 401)
|
||||
const expired = await call('GET', '/Api/Projects', kv({ viewExpiresAt: Date.now() - 1000 }))
|
||||
assert.equal(expired.status, 401)
|
||||
})
|
||||
|
||||
test('Tab mit Kennung, Cookie ist keine Kundenansicht mehr -> 409 statt fremder Daten', async () => {
|
||||
const header = { 'x-kundenansicht': VIEW }
|
||||
for (const cookie of [customerCookie('c2'), viewAsCookie('c2')]) {
|
||||
const res = await call('GET', '/api/projects', { cookie, headers: header })
|
||||
assert.equal(res.status, 409)
|
||||
assert.deepEqual([res.body.code, res.body.kunde], ['view_replaced', 'Kunde Zwei'])
|
||||
}
|
||||
const res = await call('GET', '/api/projects', { cookie: customerCookie('c2'), headers: header })
|
||||
assert.equal(res.status, 409)
|
||||
assert.deepEqual([res.body.code, res.body.kunde], ['view_replaced', 'Kunde Zwei'])
|
||||
// alte Ansicht ohne Kennung: beendet, ebenfalls keine fremden Daten
|
||||
assert.equal((await call('GET', '/api/projects', { cookie: viewAsCookie('c2'), headers: header })).status, 401)
|
||||
// ohne Cookie: kein fremder Kunde, die Route antwortet selbst mit 401
|
||||
assert.equal((await call('GET', '/api/projects', { headers: header })).status, 401)
|
||||
})
|
||||
Reference in new issue
Block a user