System Information
-
Strapi Version: 3.6.8
-
Operating System: Linux Debian
-
Database: sqlite
-
Node Version: 14.x
-
NPM Version: 6.14.12
Hey I am trying to reverse engineer how the user creation process works from the front end. When i click the button save, i see:
POST /content-manager/collection-types/plugins::users-permissions.user
My need is to be able to limit the number of total users of a certain type.
Now, i tried copying the folder onto the extensions folder of strapi but it spit out an error. Probably i am totally off road, but how would go about setting up this users limit?
Thanks
Valerio
I’ve done a bit of further research and it seems that the file is /node_modules/strapi-plugin-content-manager/controllers/collection-types.js, in particular:
async create(ctx) {
const { userAbility, user } = ctx.state;
const { model } = ctx.params;
const { body } = ctx.request;
strapi.log.debug(model);
strapi.log.debug(body);
const entityManager = getService('entity-manager');
const permissionChecker = getService('permission-checker').create({ userAbility, model });
if (permissionChecker.cannot.create()) {
return ctx.forbidden();
}
const pickWritables = pickWritableAttributes({ model });
const pickPermittedFields = permissionChecker.sanitizeCreateInput;
const setCreator = setCreatorFields({ user });
const sanitizeFn = pipe([pickWritables, pickPermittedFields, setCreator]);
await wrapBadRequest(async () => {
const entity = await entityManager.create(sanitizeFn(body), model);
ctx.body = permissionChecker.sanitizeOutput(entity);
await strapi.telemetry.send('didCreateFirstContentTypeEntry', { model });
})();
},
However:
- strapi.log.debug() does not show anything
- seems kinda awkward, to me, to control what content can be limited