Skip to content

Gift links: Admin Integration access - #28669

Merged
jonatansberg merged 1 commit into
mainfrom
ber-3739-admin-integration-gift-links
Jun 17, 2026
Merged

jonatansberg merged 1 commit into
mainfrom
ber-3739-admin-integration-gift-links

Conversation

@jonatansberg

Copy link
Copy Markdown
Member

Fast-follow to the merged gift-links data foundation (#28626), addressing Kevin's review question:

Non-blocker: Should Admin integrations have access to gift links so there is programmatic access/management?

ref https://linear.app/ghost/issue/BER-3739/admin-integration-access-to-gift-links

What

Grants the Admin Integration role the existing Manage gift links (gift_link: manage) permission, so gift links can be created / ensured / reset programmatically over the Admin API.

Why this scope

  • manage only, not all. Mirrors Editor / Author / Super Editor. The endpoint's own edit.post ownership check still applies — Admin Integrations hold post: all, so they pass it for any post.
  • Site-wide resetAll stays Administrator-only. A leaked integration key should not be able to deactivate every active gift link site-wide in one call.
  • Still gated behind the off-by-default giftLinks labs flag, so this is inert until the rest of the stack lands and the flag is enabled.

Changes

  • New 6.46 migration linking Manage gift links → Admin Integration (down removes it)
  • gift_link: manage added to Admin Integration in both fixtures.json files (fresh installs)
  • Updated migration.test.js, fixture-manager.test.js (147 → 148), and the integrity fixtures hash

Migration + fixture + integrity tests pass locally.

ref https://linear.app/ghost/issue/BER-3739/admin-integration-access-to-gift-links

- fast-follow to the merged gift-links data foundation (#28626), addressing
  Kevin's review question about programmatic access/management
- grants Admin Integration the same per-post `manage` permission Editors and
  Authors already have, so gift links can be created/reset over the Admin API;
  the endpoint's own edit.post ownership check still applies (integrations hold
  post:all, so they pass it)
- the site-wide `resetAll` kill switch stays Administrator-only — a leaked
  integration key should not be able to nuke every active gift link at once
- migration lands in the same 6.46 cycle as the foundation; fixtures + integrity
  hash + permission-count tests updated to match
@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ef31b7c2-8d36-4aa5-b0e6-343db92d6c15

📥 Commits

Reviewing files that changed from the base of the PR and between 337cac4 and 3284cf8.

📒 Files selected for processing (6)
  • ghost/core/core/server/data/migrations/versions/6.46/2026-06-17-10-00-00-add-gift-links-permission-to-admin-integration.js
  • ghost/core/core/server/data/schema/fixtures/fixtures.json
  • ghost/core/test/integration/migrations/migration.test.js
  • ghost/core/test/unit/server/data/schema/fixtures/fixture-manager.test.js
  • ghost/core/test/unit/server/data/schema/integrity.test.js
  • ghost/core/test/utils/fixtures/fixtures.json

Walkthrough

A new database migration grants the "Admin Integration" role the "Manage gift links" permission via addPermissionToRole. The Administrator role's permissions map in fixtures.json (both production and test) is extended with a gift_link: "manage" entry. The integration migration test's assertHavePermission call for "Manage gift links" is updated to include "Admin Integration" in the expected roles list. The fixture manager unit test increments its FIXTURE_COUNT from 147 to 148, and the fixture integrity test's currentFixturesHash is updated to match the new fixture content.

Possibly related PRs

  • TryGhost/Ghost#28626: Foundational gift-links work that introduced the "Manage gift links" permission and its initial role assignments, which this PR extends by adding Admin Integration.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Gift links: Admin Integration access' directly and clearly summarizes the main change—granting Admin Integration role access to gift links management.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the purpose, scope, and implementation details of granting Admin Integration access to gift links.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ber-3739-admin-integration-gift-links

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the migration [pull request] Includes migration for review label Jun 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

It looks like this PR contains a migration 👀
Here's the checklist for reviewing migrations:

General requirements

  • ⚠️ Tested performance on staging database servers, as performance on local machines is not comparable to a production environment
  • Satisfies idempotency requirement (both up() and down())
  • Does not reference models
  • Filename is in the correct format (and correctly ordered)
  • Targets the next minor version
  • All code paths have appropriate log messages
  • Uses the correct utils
  • Contains a minimal changeset
  • Does not mix DDL/DML operations
  • Tested in MySQL and SQLite

Schema changes

  • Both schema change and related migration have been implemented
  • For index changes: has been performance tested for large tables
  • For new tables/columns: fields use the appropriate predefined field lengths
  • For new tables/columns: field names follow the appropriate conventions
  • Does not drop a non-alpha table outside of a major version

Data changes

  • Mass updates/inserts are batched appropriately
  • Does not loop over large tables/datasets
  • Defends against missing or invalid data
  • For settings updates: follows the appropriate guidelines

@jonatansberg
jonatansberg marked this pull request as ready for review June 17, 2026 06:48
@nx-cloud

nx-cloud Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 3284cf8

Command Status Duration Result
nx run ghost:test:ci:integration:no-coverage ✅ Succeeded 1m 56s View ↗
nx run ghost:test:ci:integration ✅ Succeeded 1m 10s View ↗
nx run ghost:test:ci:e2e:no-coverage ✅ Succeeded 4m 2s View ↗
nx run ghost:test:ci:e2e ✅ Succeeded 3m 54s View ↗
nx run ghost:test:ci:legacy ✅ Succeeded 2m 20s View ↗
nx build @tryghost/sodo-search ✅ Succeeded <1s View ↗
nx build @tryghost/announcement-bar ✅ Succeeded <1s View ↗
nx build @tryghost/comments-ui ✅ Succeeded <1s View ↗
Additional runs (10) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-17 06:55:14 UTC

@jonatansberg
jonatansberg requested a review from rob-ghost June 17, 2026 06:48
@jonatansberg
jonatansberg merged commit 0f5becb into main Jun 17, 2026
51 checks passed
@jonatansberg
jonatansberg deleted the ber-3739-admin-integration-gift-links branch June 17, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

migration [pull request] Includes migration for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants