demo: limit to 20 apps
This commit is contained in:
@@ -1162,6 +1162,11 @@ async function validateLocations(locations) {
|
||||
return domainObjectMap;
|
||||
}
|
||||
|
||||
async function getCount() {
|
||||
const result = await database.query('SELECT COUNT(*) AS total FROM apps');
|
||||
return result[0].total;
|
||||
}
|
||||
|
||||
async function install(data, auditSource) {
|
||||
assert(data && typeof data === 'object');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
@@ -1237,6 +1242,8 @@ async function install(data, auditSource) {
|
||||
|
||||
const domainObjectMap = await validateLocations(locations);
|
||||
|
||||
if (settings.isDemo() && getCount() >= constants.DEMO_APP_LIMIT) throw new BoxError(BoxError.BAD_STATE, 'Too many installed apps, please uninstall a few and try again');
|
||||
|
||||
const appId = uuid.v4();
|
||||
debug('Will install app with id : ' + appId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user