mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
- Introduced a new `createGuard` function to streamline the creation of Guard instances with permissions and roles. - Updated tests in `authorize.spec.ts` to reflect changes in permission checks, ensuring they now return undefined for denied permissions. - Added new `Permission` and `Policy` classes to improve type safety and flexibility in permission management. - Refactored middleware and controller files to utilize the updated permission structure, including context handling for permissions. - Created a new `SystemController.spec.ts` file to test the integration of the new permission system within the SystemController. - Removed legacy permission handling from core security files, consolidating permission logic within the new structure.
21 lines
678 B
TypeScript
21 lines
678 B
TypeScript
import { describe, it, expect } from "bun:test";
|
|
import { SystemController } from "modules/server/SystemController";
|
|
import { createApp } from "core/test/utils";
|
|
import type { CreateAppConfig } from "App";
|
|
import { getPermissionRoutes } from "auth/middlewares/permission.middleware";
|
|
|
|
async function makeApp(config: Partial<CreateAppConfig> = {}) {
|
|
const app = createApp(config);
|
|
await app.build();
|
|
return app;
|
|
}
|
|
|
|
describe("SystemController", () => {
|
|
it("...", async () => {
|
|
const app = await makeApp();
|
|
const controller = new SystemController(app);
|
|
const hono = controller.getController();
|
|
console.log(getPermissionRoutes(hono));
|
|
});
|
|
});
|