Share announcement read grant with Enterprise User and Read-Only roles - #1021
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
Share announcement read grant with Enterprise User and Read-Only roles#1021posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
The announcement read permissions lived only on the Basic User Policy, and that policy is attached to the Basic User role alone. Every signed-in user on the Enterprise User or Read-Only role got a Directus FORBIDDEN response the moment the sidebar inbox polled for announcements, so those accounts saw no announcements and no unread count. Add a dedicated read-only "Announcements" policy that grants read on the announcement content and read/create/update on the per-user activity rows, and attach it to the Enterprise User and Read-Only roles. Basic User keeps its own grant and is left untouched. - Add idempotent Directus REST migration script that creates the policy and attaches it to the two roles. - Update the sync collection JSON to the same end state. - Delete the unused useWhatsNewAnnouncements hook. Generated-By: PostHog Desktop Task-Id: b98b1698-f891-4ec2-864c-dcd1fd93e4cd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
announcement,announcement_translations,announcement_activity) sits on one policy, the Basic User Policy, which is attached to the Basic User role only. Any other app role gets a DirectusFORBIDDENthe moment the sidebar loads.Changes
Announcementspolicy and attach it to the Enterprise User and Read-Only roles. It grants read on announcement content plus read/create/update on the per-user activity rows, so the inbox and its unread count work while announcement content stays read-only. Basic User keeps its own grant, untouched.directus/migrations/add_announcement_read_policy.py), per the repo's Directus workflow, and update the sync collection JSON to the same end state.useWhatsNewAnnouncementshook. It had zero references and, unlike its siblings, was not gated oncurrentUser.Why a shared policy
Announcementspolicy, one set of rows, attached to each roleAgent context
bash sync.sh ... pullto regenerate canonical sync IDs before deploy. Both paths push cleanly.announcement_activitydeleteandannouncementupdate(both present on Basic User Policy) are left off the new policy on purpose: the frontend never calls them, and omitting them keeps Read-Only read-only.Created with PostHog Desktop from this inbox report.