Repository navigation
Add a typed profile resource for the self-service profile.json endpoint - #51
Merged
Merged
Conversation
Contributor
Author
|
@claude Please review this PR. |
put for off-resource writes (e.g. profile.json)profile resource for the self-service profile.json endpoint
jlocke2
approved these changes
Sep 10, 2026
…dpoint
Resource#save always PUTs to {collection}/{id}.json — the admin-gated users
endpoint — so there was no way to write the singular self-service profile.json
(Api::V3::ProfilesController), where a user updates their own record (incl.
work_phone/mobile_number) without account-admin rights.
Add a typed Pipeline::Profile following the gem's existing inheritance (same
shape as Pipeline::Import): a `pipeline.profile` accessor mirroring user/account,
and a save overriding only the endpoint (profile.json, not collection/id) and
the :user body key (ProfilesController#update reads params[:user]). Bump 1.0.12.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sevgibson
force-pushed
the
DP-206-add-put-endpoint
branch
from
September 10, 2026 21:21
d9819a6 to
ca0d7f4
Compare
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.
Why
Resource#savealways PUTs to{collection}/{id}.json— the users endpoint, which is account-admin-gated on p.core. So there was no way to write the singular self-serviceprofile.json(Api::V3::ProfilesController), where a user updates their own record (includingwork_phone/mobile_number) without admin rights.This unblocks p.int's Pipeline Phone
work_phonesync (DP-206): it sets a provisioned user'swork_phoneas that user themselves.What
A typed
Pipeline::Profileresource, following the gem's existing inheritance (same shape asPipeline::Import— aResourcesubclass in its own file):pipeline.profileaccessor mirrors the existinguser/accountsingular accessors (loadsprofile.json).Pipeline::Profile#saveoverrides only what differs fromResource#save: the endpoint (profile.json, notprofiles/:id) and the body key (:user, sinceProfilesController#updatereadsparams[:user]). Attributes + dirty-tracking are inherited, sosavestill sends only changed keys.Version bump 1.0.11 → 1.0.12.
Tests
spec/pipeline/profile_spec.rb— loads fromprofile.json, saves changed attributes back under the:userkey, and raises the mapped exception (403 →PermissionDeniedError) on refusal. WebMock, mirroring the existing endpoint spec style.Consumers
p.int will bump to this revision and change
sync_user_work_phonetopipeline_api_for_user(user_id).profile→ setwork_phone→save, guarding against the no-token fallback (which would otherwise write the admin's own profile).🤖 Generated with Claude Code