Skip to content

added user role update event#8674

Open
RjManhas wants to merge 1 commit into
logto-io:masterfrom
RjManhas:master
Open

added user role update event#8674
RjManhas wants to merge 1 commit into
logto-io:masterfrom
RjManhas:master

Conversation

@RjManhas
Copy link
Copy Markdown

@RjManhas RjManhas commented Apr 19, 2026

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

  • [x ] .changeset
  • [x ] unit tests
  • [x ] integration tests
  • [ x] necessary TSDoc comments

@github-actions
Copy link
Copy Markdown

COMPARE TO master

Total Size Diff ⚠️ 📈 +15.76 KB

Diff by File
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

Copy link
Copy Markdown
Contributor

@wangsijie wangsijie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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: ⚠️ Needs attention

'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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏗️ [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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏗️ [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.

Comment thread package.json
"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": "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏗️ [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.

@simeng-li
Copy link
Copy Markdown
Contributor

@RjManhas, please check the failed CI jobs

@simeng-li simeng-li added the pending-verification Something is still under investigation label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-verification Something is still under investigation size/xl

Development

Successfully merging this pull request may close these issues.

3 participants