Add new service to user-permissions plugin

I’m running Strapi 4.1.7 and want to extend the user-permissions plugin with custom services.

Adding controllers and routes works a charm simply by following the documentation, but adding services with plugin.controllers.controllerA.find = (ctx) => {}; does not.

I’m calling the service using await strapi.service('plugin::user-permissions.user').example() since the plugin object is not available in bootstrap().

Anyone who can provide some insights that the documentation doesn’t?

Cheers

2 Likes

Were you able to figure this out?

Yes, through src/exenstions/users-permissions/strapi-server.js:

const firebase_services = require("./services/firebase")

module.exports = (plugin) => {
  plugin.services['firebase'] = firebase_services
  return plugin;
};

Strapi is wonderful. Strapi’s documentation is awful.

Hope it helps.

2 Likes