Skip to content

fix(organizations): add REST endpoint for branding logo upload signing - #231

Merged
arthurzeras merged 1 commit into
mainfrom
fix/branding-logo-upload-params-endpoint
Aug 7, 2026
Merged

fix(organizations): add REST endpoint for branding logo upload signing#231
arthurzeras merged 1 commit into
mainfrom
fix/branding-logo-upload-params-endpoint

Conversation

@arthurzeras

Copy link
Copy Markdown
Contributor

Summary

  • The Organization Auth-Area Branding feature's logo upload always 403'd from the frontend SPA: the shipped django-s3direct signing view (POST /s3direct/get_upload_params/) is a plain Django view authenticated only by session cookie, never reachable by DRF's JWTAuthentication — so the JWT-only SPA always hit it as AnonymousUser.
  • Adds OrganizationBrandingLogoUploadParamsView (POST /branding/logo-upload-params/), the REST sibling of the existing GraphQL create_branding_logo_upload mutation, reusing organizations.branding_logo.sign_branding_logo_upload for the actual signing.
  • Gated on the two-condition branding eligibility check (parentless + entitled), not the three-condition write gate — the SPA uploads a logo on file-picker change, before the slug/branding PUT on form submit. Factored the shared eligibility check into organizations.permissions.check_branding_read_eligibility, reused by both this view and OrganizationBrandingView.get.
  • Regenerated schema.yml.

See .vinta-ai-workflows/handoffs/2026-08-06-branding-logo-upload-403.md and ai-plans/2026-08-04-ORGANIZATION_AUTH_BRANDING_SPEC.md / ai-plans/2026-08-04-ORGANIZATION_AUTH_BRANDING_IMPLEMENTATION_PLAN.md for full context.

Test plan

  • New tests in organizations/tests/test_branding_logo_upload_params.py: happy path, no-slug-org still admitted, non-admin/parented-org/unentitled-org 403s, unauthenticated 401, bad content-type/oversized-file 400s, multi-org-admin-without-header 400 (proves TenantScopedViewMixin is wired).
  • ruff check / ruff format --check clean.
  • mypy clean on touched files.
  • makemigrations --check — no changes needed (no model change).
  • Full test suite green on a fresh database (4869 passed).
  • Manual check against a running stack with a real JWT (left to reviewer/QA, or the frontend agent once wired up).

…logo upload signing

The shipped django-s3direct signing view (POST /s3direct/get_upload_params/)
is a plain Django view authenticated only by session cookie, so the JWT-only
frontend SPA always gets AnonymousUser there and is refused with a 403 on
every branding logo upload. Add OrganizationBrandingLogoUploadParamsView,
mirroring users/views.py's profile-picture-upload-params endpoint and reusing
organizations/branding_logo.py::sign_branding_logo_upload, which already
backs the equivalent GraphQL mutation.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.42%. Comparing base (f338491) to head (07e6c68).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
organizations/views.py 89.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #231      +/-   ##
==========================================
+ Coverage   87.41%   87.42%   +0.01%     
==========================================
  Files         254      254              
  Lines       21735    21769      +34     
  Branches     2446     2447       +1     
==========================================
+ Hits        19000    19032      +32     
- Misses       1944     1945       +1     
- Partials      791      792       +1     
Flag Coverage Δ
unittests 87.42% <94.87%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@arthurzeras
arthurzeras merged commit 3c298c0 into main Aug 7, 2026
6 of 9 checks passed
@arthurzeras
arthurzeras deleted the fix/branding-logo-upload-params-endpoint branch August 7, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants