I am really confused documents do not help much. How to disable users programmatically?
I think it must be related to: https://strapi.io/documentation/3.0.0-beta.x/plugins/users-permissions.html#user-object-in-strapi-context
module.exports = {
// Every monday at 1am.
'0 0 1 * * 1': () => {
// BLOCK USERS CREATED 30 DAYS AGO
},
};
I do agree with @deceze about checking the user during login to validate their account has not "expired".
Alternatively, as I mentioned in the Strapi slack you can have the cron check for users and set them as blocked using the internal API:
let today = new Date();
let blockedUsers = await strapi.query('user', 'users-permissions').find({ "blockDate_lte": today});
blockedUsers.forEach((user) => { strapi.query('user', 'users-permissions').update({ id: user.id }, { blocked: true}));