mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-09-21 17:04:00 +00:00
Declare permissions on the plugin declaration
Clusterio #988 added a permissions array to PluginDeclaration and a type level Permissions registry, and made checkPermission and the web UI hasPermission helpers take PermissionName. Move the definePermission calls of exp_groups and exp_scenario into the declaration and add the names to the registry so the web pages type check. The browser tsconfigs include index.ts so the augmentation is visible to the web bundle, matching the in-repo plugins. The exp_scenario table keeps its tuple form and derives the name union from it, so a new row is still one line. Seed role permissions are typed as PermissionName, so a typo in seed.ts is now a compile error rather than a warning at seed time. The tests register the declared permissions through registerPluginPermissions instead of importing permissions.ts for its side effect. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
24d2f76a35
commit
30f1b5ea75
@@ -3,8 +3,10 @@ const t = require("tap");
|
||||
const lib = require("@clusterio/lib");
|
||||
const { seedRoles, seedGroups, flattenSeedPermissions } = require("../dist/node/seed");
|
||||
|
||||
// Importing this defines the permissions the seed grants
|
||||
require("../dist/node/permissions");
|
||||
const { plugin } = require("../dist/node/index");
|
||||
|
||||
// Registering the plugin defines the permissions the seed grants
|
||||
lib.registerPluginPermissions([plugin]);
|
||||
|
||||
t.test("seedRoles[] grant only defined permissions", t2 => {
|
||||
for (const role of seedRoles) {
|
||||
|
||||
Reference in New Issue
Block a user