mirror of
https://github.com/strapi/strapi.git
synced 2025-10-19 20:11:06 +00:00
Add security to ensure the admin is available
This commit is contained in:
parent
ce02440ba5
commit
d0268ad397
@ -12,6 +12,7 @@ const {
|
|||||||
get,
|
get,
|
||||||
difference,
|
difference,
|
||||||
intersection,
|
intersection,
|
||||||
|
isEmpty,
|
||||||
isObject,
|
isObject,
|
||||||
isFunction,
|
isFunction,
|
||||||
} = require('lodash');
|
} = require('lodash');
|
||||||
@ -28,6 +29,10 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
async isInitialised(strapi) {
|
async isInitialised(strapi) {
|
||||||
try {
|
try {
|
||||||
|
if (isEmpty(strapi.admin)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const numberOfAdministrators = await strapi
|
const numberOfAdministrators = await strapi
|
||||||
.query('administrator', 'admin')
|
.query('administrator', 'admin')
|
||||||
.find({ _limit: 1 });
|
.find({ _limit: 1 });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user