Skip to content

feat: add read-only organization user roles - #3622

Open
arunblitz wants to merge 4 commits into
postalserver:mainfrom
arunblitz:feature/organization-readonly-users
Open

arunblitz wants to merge 4 commits into
postalserver:mainfrom
arunblitz:feature/organization-readonly-users

Conversation

@arunblitz

@arunblitz arunblitz commented Aug 20, 2026 •

Copy link
Copy Markdown

Summary

Adds per-organization user roles so teams can grant view-only access without full write permissions.

  • readonly — can browse org resources; POST/PATCH/PUT/DELETE are blocked
  • member — existing default write access within the organization
  • admin — uses the existing organization_users.admin flag for org-level management

This builds on dormant schema fields already present on organization_users and adds a read_only boolean column.

Motivation

Postal currently distinguishes global admins from organization members, but org members effectively have full write access. Several environments need auditors, support staff, or clients to view configuration and message metadata without changing settings.

This aligns with prior maintainer feedback on access control features being implemented per user rather than via global config (see #2287).

Implementation

  • OrganizationAuthorization concern blocks non-GET requests for read-only org members
  • Included via WithinOrganization across org-scoped controllers
  • User admin UI exposes a per-organization role dropdown
  • UI hides common write actions when the current user is read-only
  • Request and model specs included

Test plan

  • bundle exec rspec spec/models/organization_user_spec.rb spec/requests/readonly_organization_access_spec.rb
  • Log in as a read-only org user and confirm browsing works
  • Confirm create/update/delete actions are blocked with a clear message
  • Confirm global admins and org admins retain write access
  • Run postal upgrade / db:migrate on an existing installation

Notes

Happy to adjust naming, expand UI coverage, or discuss how this relates to other dormant organization_users fields (all_servers, user_type) before merge.

Introduce per-organization roles (readonly, member, admin) using the
existing organization_users.admin flag plus a new read_only column.
Organization-scoped controllers enforce write access for non-GET
requests, and the user admin UI exposes a role selector per organization.

Includes request and model specs covering read-only authorization.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add readonly-release workflow for arunblitz/postal that runs tests,
builds the full image, pushes to ghcr.io/<owner>/postal-readonly, and
creates a GitHub Release when a readonly version tag is pushed.

Skip upstream postalserver CI publish jobs on forks to avoid GHCR
permission failures against ghcr.io/postalserver/postal.
Explain that readonly tags are custom feature builds, not official
Postal releases. Set a clearer release title for future tag builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants