Repository navigation
feat(api): add DeleteOrganizationResource - #1991
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 38876961314Coverage increased (+0.004%) to 55.244%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
fa70075 to
05b48e9
Compare
c1beed2 to
368a325
Compare
05b48e9 to
a260af6
Compare
368a325 to
25c12c6
Compare
|
End to end against a local server, with Postgres and SpiceDB in Docker. The binary under test is the whole stack (#1985, #1986, #1987, #1989, #1990, #1991). The
|
rohilsurana
left a comment
There was a problem hiding this comment.
The new RPC looks right. One small comment inline. My earlier question on #1987 about DeleteProjectResource returning Internal for an org resource also lands in this function (line 147).
a260af6 to
8732ddf
Compare
25c12c6 to
27e4acd
Compare
8732ddf to
c02c28b
Compare
27e4acd to
92725b2
Compare
c02c28b to
d74bc74
Compare
92725b2 to
46e4a96
Compare
Delete a resource that belongs to an organization: the row is kept with deleted_at, its SpiceDB tuples are removed, and the audit records name the organization. The authorization rule refuses a resource outside the organization in the request, then checks delete on the resource. The project and organization handlers share the delete path.
46e4a96 to
31c4121
Compare
rohilsurana
left a comment
There was a problem hiding this comment.
The not found fix is in for both delete RPCs and covered by tests. The open project resource question is tracked in #2001. Approving.
Summary
DeleteOrganizationResourcedeletes a resource that belongs to an organization. Stacked on #1990.Changes
deleteon the resource and the plan entitlement on the organization.deleted_atset, removes its SpiceDB tuples, and writes the audit log and theresource.deletedaudit record naming the organization.resource.Service.Deletehandles organization resources since feat(api): add CreateOrganizationResource #1987.DeleteProjectResourceandDeleteOrganizationResourcesharegetResourceToDeleteanddeleteResource.DeleteProjectResourcekeeps its project lookup, responses, and error messages.deleteResourceanswers not found instead of internal error. This covers both delete RPCs.Test Plan
go test ./internal/api/v1beta1connect/passes, with the existingDeleteProjectResourcecases unchanged. NewTestConnectHandler_DeleteOrganizationResource: not found, a failed lookup, a failed delete, a row deleted after the lookup, and success. NewTestConnectHandler_DeleteProjectResourcecase: a row deleted after the lookup answers not found.TestResourceAPIcase 7: a member without the permission gets permission denied; the creator deletes the resource; a second delete gets not found; the creator no longer hasupdateon it; creating the same name again returns a new id; after the organization is disabled, the creator gets failed precondition and a platform superuser can still delete it.go test ./test/e2e/...passes.golangci-lint runreports no issues.