Overwrite delete method inside user-permission-plugin

Sorry my bad english, but i gonna try to explain for you guys the context: We gonna upload our production strapi admin panel, for other parts of our company, and we need to secure a delete inside the strapi panel using the user-permissions-plugin so, when a admin of the panel delete a user inside the user permissions, this user will not be really deleted inside the database, we want to keep in database that user for secure purposes.
But we can`t overwrite the default method of destroy inside the user.js controller of user-permissions-plugin, we already try to create a models or controller, folder and try to overwrite the method with the belong code, but unsuccessfully!

"use strict";

/**
 * User.js controller
 *
 * @description: A set of functions called "actions" for managing `User`.
 */

module.exports = {
  /**
   * Destroy a/an user record.
   * @return {Object}
   */
  async destroy(ctx) {
    console.log("destroy", ctx);
  },

  async destroyAll(ctx) {
    console.log("destroyAll", ctx);
  },

  async delete(ctx) {
    console.log("delete", ctx);
  },

  async remove(params) {
    console.log('delete')
  },

};

You have any idea to solve dat ? Thank you already!

1 Like