mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-16 14:47:04 -05:00
[PR #3297] Route resource rule CRUD to shared policy rules when resourcePolicyId is set
#34673
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/pangolin/pull/3297
Author: @Copilot
Created: 6/16/2026
Status: 🔄 Open
Base:
main← Head:copilot/fix-rule-rest-api-issues📝 Commits (4)
b686209Initial plan0d96018fix: update resource rule routes to use shared policy rulesa7c99f3refactor: dedupe resource rule value validation0bde633chore: simplify policy rule update/delete lookups📊 Changes
5 files changed (+109 additions, -65 deletions)
View changed files
📝
server/routers/resource/createResourceRule.ts(+2 -6)📝
server/routers/resource/deleteResourceRule.ts(+11 -7)📝
server/routers/resource/getResource.ts(+2 -8)📝
server/routers/resource/listResourceRules.ts(+2 -6)📝
server/routers/resource/updateResourceRule.ts(+92 -38)📄 Description
Resource rule APIs were reading rule IDs from policy-backed data while update/delete still targeted legacy
resourceRules, causing “rule not found” and unstable IDs after new rule creation. This change aligns read/write paths so rule IDs are resolved against the same backing store.Policy-vs-resource rule source alignment
resource.resourcePolicyIdis present:getResource.tsnow overlays policy settings fromresourcePolicyId(notdefaultResourcePolicyId).listResourceRules.tsnow lists/counts fromresourcePolicyRulesfor policy-backed resources.resourceRulesbehavior for resources withoutresourcePolicyId.CRUD consistency for policy-backed resources
createResourceRule.ts: inserts intoresourcePolicyRuleswhenresourcePolicyIdis set.updateResourceRule.ts: updatesresourcePolicyRulesfor policy-backed resources; otherwise usesresourceRules.deleteResourceRule.ts: deletes fromresourcePolicyRulesfor policy-backed resources; otherwise usesresourceRules.Rule ownership scoping + validation cleanup
ruleIdandresourcePolicyIdto avoid cross-policy ID collisions.updateResourceRule.tsvia a shared helper used by both policy and legacy branches.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.