Adding custom policy to user-permissions plugin

System Information
  • Strapi Version: 4
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Trying to add a new policy to users-permissions plugin.

Created a file called user-create.js under extensions/users-permissions/policies

Contents of file:
``
module.exports = async (policyContext, config, { strapi }) => {
console.log(‘Should be creating a user’);
};

module.exports = {
routes: [
{
method: ‘POST’,
path: ‘/auth/local/register’,
handler: ‘auth.register’,
config: {
policies: [‘plugin::users-permissions.user-create’]
}
}
]
}
``

Logic never fires when a user is registered using REST api (Postman)