mirror of
https://github.com/strapi/strapi.git
synced 2025-08-22 15:48:59 +00:00
Put providers
This commit is contained in:
parent
9b1347d092
commit
e425125f82
@ -96,7 +96,6 @@
|
|||||||
"policies": []
|
"policies": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"path": "/providers",
|
"path": "/providers",
|
||||||
@ -106,6 +105,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/providers",
|
||||||
|
"handler": "UsersPermissions.updateProviders",
|
||||||
|
"config": {
|
||||||
|
"policies": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
|
@ -207,5 +207,22 @@ module.exports = {
|
|||||||
|
|
||||||
getProviders: async (ctx) => {
|
getProviders: async (ctx) => {
|
||||||
ctx.send(strapi.plugins['users-permissions'].config.grant);
|
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