added user role update event#8674
Conversation
COMPARE TO
|
| Name | Diff |
|---|---|
| .gitattributes | 📈 +288 Bytes |
| Dockerfile | 📈 +310 Bytes |
| docker-compose.local.yml | 📈 +1.36 KB |
| package.json | 📈 +24 Bytes |
| packages/core/src/libraries/hook/context-manager.ts | 📈 +387 Bytes |
| packages/core/src/routes/admin-user/role.ts | 📈 +1.17 KB |
| packages/core/src/routes/organization/index.ts | 📈 +24 Bytes |
| packages/core/src/routes/organization/user/index.ts | 📈 +955 Bytes |
| packages/core/src/routes/organization/user/role-relations.ts | 📈 +2.14 KB |
| packages/core/src/routes/role.user.ts | 📈 +1.21 KB |
| packages/integration-tests/src/tests/api/hook/hook.trigger.data.test.ts | 📈 +3.54 KB |
| packages/integration-tests/src/tests/api/hook/test-cases.ts | 📈 +3.93 KB |
| packages/schemas/src/foundations/jsonb-types/hooks.ts | 📈 +465 Bytes |
wangsijie
left a comment
There was a problem hiding this comment.
🤖 PR Review
This PR adds role-update webhook events and richer payloads for management routes, plus local Docker setup changes.
- 🔒 Security: clean
- 🏗️ Architecture: 0 high, 3 medium
- 👨💻 Engineering: clean
Verdict:
| 'PATCH /users/:userId/profile': 'User.Data.Updated', | ||
| 'PATCH /users/:userId/password': 'User.Data.Updated', | ||
| 'PATCH /users/:userId/is-suspended': 'User.SuspensionStatus.Updated', | ||
| // `User.Roles.Updated` is triggered manually in each user-role route so the |
There was a problem hiding this comment.
🏗️ [Medium]: User.Roles.Updated is emitted only from the management user-role routes even though user roles are also assigned during user creation/default-role provisioning, so the webhook contract now depends on which code path performed the mutation.
| 'POST /organizations': 'Organization.Created', | ||
| 'DELETE /organizations/:id': 'Organization.Deleted', | ||
| 'PATCH /organizations/:id': 'Organization.Data.Updated', | ||
| // `Organization.UserRoles.Updated` is triggered manually in each org-user-role route so the |
There was a problem hiding this comment.
🏗️ [Medium]: Organization.UserRoles.Updated is tied to the organization user-role routes, but org roles are also assigned from invitation acceptance, JIT provisioning, and first-admin provisioning, leaving the event model source-dependent instead of mutation-based.
| "preinstall": "npx only-allow pnpm", | ||
| "pnpm:devPreinstall": "cd packages/connectors && node templates/sync-preset.js", | ||
| "prepare": "if test \"$NODE_ENV\" != \"production\" && test \"$CI\" != \"true\" ; then husky ; fi", | ||
| "prepare": "", |
There was a problem hiding this comment.
🏗️ [Medium]: Blanking the root prepare script turns a Docker-specific workaround into a repo-wide install contract change and removes the shared lifecycle hook future local bootstrap steps would need.
|
@RjManhas, please check the failed CI jobs |
Summary
Added new webhook events for when user or a user org roles are updated.
Testing
I tested it by building a docker compose, and testing api routes etc.
Checklist
.changeset