Repository navigation
feat(api): add UpdateOrganizationResource - #1990
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 51 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 38874225151Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.03%) to 55.03%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
720735f to
3e237c1
Compare
fa70075 to
05b48e9
Compare
3e237c1 to
88e94de
Compare
05b48e9 to
a260af6
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 disabled org check now covers org resources, which fixes my earlier question on #1987. Approving, with two small comments inline.
88e94de to
57293d0
Compare
a260af6 to
8732ddf
Compare
57293d0 to
89ddff6
Compare
8732ddf to
c02c28b
Compare
Update a resource that belongs to an organization. The authorization rule refuses a resource that is not an organization resource of the organization in the request, then checks update on the resource. The disabled organization check now reads the resource's org_id, so it covers organization resources. The project and organization handlers share the update path and the request body handling.
c02c28b to
d74bc74
Compare
Summary
UpdateOrganizationResourceupdates a resource that belongs to an organization. Stacked on #1987.Changes
updateon the resource and the plan entitlement on the organization. The check that the resource belongs to the organization followsensureRoleBelongToOrg.org_idand falls back to its project for rows without one, so organization resources in a disabled organization return failed precondition.UpdateProjectResourceandUpdateOrganizationResourceshareupdateResource.UpdateProjectResourcekeeps its project lookup, responses, and error messages.resourceFromBodybuilds the resource from the request body for both create and update.Technical Details
org_idread in the disabled organization check, an update in a disabled organization does not return failed precondition.Test Plan
go test ./internal/api/v1beta1connect/passes, with theUpdateProjectResourcecases unchanged. NewTestConnectHandler_UpdateOrganizationResource: missing body, not found, bad detail, conflict, internal error, and success withorg_id. NewTestIsAuthorizedcase: an organization resource resolves to its disabled organization without a project lookup.TestResourceAPIcase 6: the creator updates the title and metadata; a member without the permission, another organization in the request, and a project resource id each get permission denied; a missing id gets not found; after the organization is disabled, the creator gets failed precondition and a platform superuser can still update it. With theorg_idread removed, the creator's step no longer returns failed precondition.go test ./test/e2e/...passes.golangci-lint runreports no issues.