mirror of
https://github.com/strapi/strapi.git
synced 2025-08-21 23:28:58 +00:00
Put providers
This commit is contained in:
parent
9b1347d092
commit
e425125f82
@ -96,7 +96,6 @@
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"method": "GET",
|
||||
"path": "/providers",
|
||||
@ -106,6 +105,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"method": "PUT",
|
||||
"path": "/providers",
|
||||
"handler": "UsersPermissions.updateProviders",
|
||||
"config": {
|
||||
"policies": []
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"method": "POST",
|
||||
|
@ -207,5 +207,22 @@ module.exports = {
|
||||
|
||||
getProviders: async (ctx) => {
|
||||
ctx.send(strapi.plugins['users-permissions'].config.grant);
|
||||
},
|
||||
|
||||
updateProviders: async (ctx) => {
|
||||
if (_.isEmpty(ctx.request.body)) {
|
||||
return ctx.badRequest(null, [{ messages: [{ id: 'Cannot be empty' }] }]);
|
||||
}
|
||||
|
||||
strapi.reload.isWatching = false;
|
||||
|
||||
fs.writeFileSync(path.join(strapi.config.appPath, 'plugins', 'users-permissions', 'config', 'grant.json'), JSON.stringify({
|
||||
grant: ctx.request.body
|
||||
}, null, 2), 'utf8');
|
||||
|
||||
|
||||
ctx.send({ ok: true });
|
||||
|
||||
strapi.reload();
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user