mirror of
https://github.com/strapi/strapi.git
synced 2025-07-09 10:02:51 +00:00
36 lines
580 B
JavaScript
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) });
|
|
}
|
|
};
|