2017-11-15 15:06:09 +01:00

36 lines
580 B
JavaScript

'use strict';
/**
* UsersPermissions.js controller
*
* @description: A set of functions called "actions" of the `users-permissions` plugin.
*/
const _ = require('lodash');
module.exports = {
/**
* Default action.
*
* @return {Object}
*/
index: async (ctx) => {
// Add your own logic here.
// Send 200 `ok`
ctx.send({
message: 'ok'
});
},
init: async (ctx) => {
const hasAdmin = await strapi.plugins['users-permissions'].models.user.find({
admin: true
});
ctx.send({ hasAdmin: !_.isEmpty(hasAdmin) });
}
};