Plain App Router admin (aligned to habbo-next, no Refine): - rank surfaced on the NextAuth session; staff guard isStaff() [pure, unit-tested] + requireStaff() reading min_staff_rank, gating /admin. - /admin dashboard (counts), /admin/users (paginated + search), /admin/users/[id] detail. - src/actions/admin-users.ts: staff-gated server actions wiring the user editor to the existing services — giveCurrency (RCON or DB fallback), setMotto/setRank (DB + RCON), alertUser, disconnectUser. Verified: tsc exit 0, vitest 45/45, next build exit 0 (/admin routes).
15 lines
391 B
TypeScript
15 lines
391 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isStaff } from "./is-staff";
|
|
|
|
describe("isStaff", () => {
|
|
it("is true at or above the min staff rank", () => {
|
|
expect(isStaff(7, 7)).toBe(true);
|
|
expect(isStaff(10, 7)).toBe(true);
|
|
});
|
|
|
|
it("is false below the min staff rank", () => {
|
|
expect(isStaff(6, 7)).toBe(false);
|
|
expect(isStaff(1, 7)).toBe(false);
|
|
});
|
|
});
|