mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-11-04 09:35:24 +00:00
feat: let a request approved in a plugin run by permissions
This commit is contained in:
1 parent
446596989e
commit
03029cd372
2 files changed
+11
-1
No files matched your search
@@ -69,7 +69,8 @@ export function clearApprovalPolicies(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const RANK = { allow: 0, approve: 1, deny: 2 } as const;
|
const RANK = { allow: 0, approve: 1, deny: 2 } as const;
|
||||||
const TRUSTED_VIA = new Set(["automation", "rollout", "fleet"]);
|
// approved: a person approved this exact request in the plugin's own UI.
|
||||||
|
const TRUSTED_VIA = new Set(["automation", "rollout", "fleet", "approved"]);
|
||||||
const SELF_APPROVE_VIA = new Set(["assistant", "mcp", "automation"]);
|
const SELF_APPROVE_VIA = new Set(["assistant", "mcp", "automation"]);
|
||||||
|
|
||||||
/** A person is the check when the request came from something else. */
|
/** A person is the check when the request came from something else. */
|
||||||
|
|||||||
@@ -451,6 +451,15 @@ describe("policy", () => {
|
|||||||
expect(outcome.status).toBe("success");
|
expect(outcome.status).toBe("success");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("lets a request a person approved in a plugin go by RBAC", async () => {
|
||||||
|
register();
|
||||||
|
const outcome = await runOperation({
|
||||||
|
...base,
|
||||||
|
origin: { kind: "plugin", pluginId: "x", via: "approved" },
|
||||||
|
});
|
||||||
|
expect(outcome.status).toBe("success");
|
||||||
|
});
|
||||||
|
|
||||||
it("treats a community read as a change", async () => {
|
it("treats a community read as a change", async () => {
|
||||||
state.plugin.source = "user";
|
state.plugin.source = "user";
|
||||||
state.plugin.signedTier = "community";
|
state.plugin.signedTier = "community";
|
||||||
|
|||||||
Reference in new issue
Block a user