Allowed core integrations to work with Admin API

This commit is contained in:
Aileen Nowak 2022-08-09 11:09:13 +01:00 committed by Aileen Booker
parent c813e5d96e
commit 0e284edbad
6 changed files with 6 additions and 14 deletions

View File

@ -672,7 +672,7 @@
"slug": "ghost-explore",
"name": "Ghost Explore",
"description": "Built-in Ghost Explore integration",
"type": "builtin",
"type": "core",
"api_keys": [{"type": "admin", "role": "Ghost Explore Integration"}]
},
{

View File

@ -319,7 +319,7 @@ module.exports = {
maxlength: 50,
nullable: false,
defaultTo: 'custom',
validations: {isIn: [['internal', 'builtin', 'custom']]}
validations: {isIn: [['internal', 'builtin', 'custom', 'core']]}
},
name: {type: 'string', maxlength: 191, nullable: false},
slug: {type: 'string', maxlength: 191, nullable: false, unique: true},

View File

@ -127,11 +127,7 @@ const authenticateWithToken = async (req, res, next, {token, JWT_OPTIONS}) => {
// CASE: blocking all non-internal: "custom" and "builtin" integration requests when the limit is reached
if (limitService.isLimited('customIntegrations')
&& (apiKey.relations.integration
&& !['internal'].includes(apiKey.relations.integration.get('type'))
&& !['ghost-explore'].includes(apiKey.relations.integration.get('slug'))
)
) {
&& (apiKey.relations.integration && !['internal', 'core'].includes(apiKey.relations.integration.get('type')))) {
// NOTE: using "checkWouldGoOverLimit" instead of "checkIsOverLimit" here because flag limits don't have
// a concept of measuring if the limit has been surpassed
await limitService.errorIfWouldGoOverLimit('customIntegrations');

View File

@ -43,11 +43,7 @@ const authenticateContentApiKey = async function authenticateContentApiKey(req,
// CASE: blocking all non-internal: "custom" and "builtin" integration requests when the limit is reached
if (limitService.isLimited('customIntegrations')
&& (apiKey.relations.integration
&& !['internal'].includes(apiKey.relations.integration.get('type'))
&& !['ghost-explore'].includes(apiKey.relations.integration.get('slug'))
)
) {
&& (apiKey.relations.integration && !['internal', 'core'].includes(apiKey.relations.integration.get('type')))) {
// NOTE: using "checkWouldGoOverLimit" instead of "checkIsOverLimit" here because flag limits don't have
// a concept of measuring if the limit has been surpassed
await limitService.errorIfWouldGoOverLimit('customIntegrations');

View File

@ -36,7 +36,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = '45337ae85129a98e4c1b551cc91790da';
const currentFixturesHash = 'a75211a41f515202280be7cb287e101f';
const currentFixturesHash = '0ae1887dd0b42508be946bdbd20d41c8';
const currentSettingsHash = 'd54210758b7054e2174fd34aa2320ad7';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';

View File

@ -845,7 +845,7 @@
"slug": "ghost-explore",
"name": "Ghost Explore",
"description": "Built-in Ghost Explore integration",
"type": "builtin",
"type": "core",
"api_keys": [{"type": "admin", "role": "Ghost Explore Integration"}]
},
{