V4 Override content-manager-user.js

I need to update the async update(ctx) function in node_modules/@strapi/plugin-users-permissions/server/controllers/content-manager-user.js
Is it possible?
I’m trying to override in src/extensions folder but can’t find the way

Here is the docs of modify extension interface: Plugins extension - Strapi Developer Docs

You can customize the function like this:

  1. create file ‘src/extensions/users-permissions/strapi-server.js’
  2. modify the function in this file, code :
module.exports = (plugin) => {
  console.log(plugin.controllers.contentmanageruser.update.toString())
  plugin.controllers.contentmanageruser.update = async (ctx) => {
    console.log(ctx)
    // you customize code here
  }

  console.log(plugin.controllers.contentmanageruser.update.toString())
  return plugin
}

I think this should be work, you can have a try.

1 Like

Exactely what I was looking for.
Thank you very much!