38 lines
647 B
JavaScript
Raw Normal View History

'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
});
2017-11-15 16:59:12 +01:00
console.log(await strapi.query('user', 'users-permissions'));
ctx.send({ hasAdmin: !_.isEmpty(hasAdmin) });
}
};