Skip to content
Docs
Changelog

Roles, permissions and consent for sensitive data

Staff platform roles (support, analyst), Custom roles per Organization with a permission matrix, permission checks in procedures, and per-category Consent before anyone reads a Member's measurements, health records or progress photos.

Markdown

  • Platform roles for staff. Besides user and admin, an Admin can now make a User support (feedback) or analyst (analytics and errors). Only admin still manages Users; the staff roles are for platform screens that check a permission with platformProcedure, which re-reads the database session. See Roles and permissions.
  • Custom roles per Organization. An owner, an admin or anyone holding "Manage roles" defines up to 20 roles of its own (for example coach) from a fixed list of permissions, on the roles screen at /admin/roles; /admin now opens to any Member whose role grants one of its screens. Writes go through Better Auth's dynamic access control: you can only grant what you hold, a role still assigned cannot be deleted, roles are never renamed, and every create, update and delete is audited (org.role_created, org.role_updated, org.role_deleted). Owner and admin are built in and never lose "Manage roles". See Custom roles.
  • Permission checks in procedures. requirePermission({ feedback: ["triage"] }) after orgProcedure decides from the Member's built-in and Custom roles, read under row-level security on every request, so an edited role counts on the next call. The new organization_role table and its grants are covered by the RLS isolation suite and test:rls-matrix. See Guard a procedure.
  • Consent before sensitive data. A Member turns each category (measurements, health records, progress photos) on or off for their Organization, on the web account settings and on the app's Privacy screen; staff with sensitiveData: read see everyone's state at /admin/consent. sensitiveDataRead lets a procedure return another Member's sensitive data only with the permission and the subject's current Consent, and records a sensitive_data.viewed Audit Event in the same transaction; withdrawing Consent hides the data on the next call. Grants and revokes are audited with their category, and the consent row keeps the text version it was given under (a grant under an older text no longer counts). See Consent for sensitive data and ADR-0016.

PR #219

Edit on GitHubDocumentation is in English.
Cookie settings
We use essential cookies to make our app work. With your consent, we also use optional cookies to improve your experience.

Read our Cookie Policy and Privacy Policy.