Enabled Admin integration for tiers and offers API (#14325)

As multiple tiers is now GA, we want to allow devs to be able to work with Tiers and offers via content/Admin API. This change -

- updates fixtures to add permissions to admin integration role for new sites
- adds migration to update existing sites to have correct permissions for role
- whitelists add/edit/read/browse on tiers and offers API for integrations
This commit is contained in:
Rishabh Garg 2022-03-16 16:46:26 +05:30 committed by GitHub
parent 52c1aadf05
commit f9aa18a534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,23 @@
const {
combineTransactionalMigrations,
addPermissionToRole
} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Browse offers',
role: 'Admin Integration'
}),
addPermissionToRole({
permission: 'Read offers',
role: 'Admin Integration'
}),
addPermissionToRole({
permission: 'Edit offers',
role: 'Admin Integration'
}),
addPermissionToRole({
permission: 'Add offers',
role: 'Admin Integration'
})
);

View File

@ -0,0 +1,20 @@
const {combineTransactionalMigrations, addPermissionToRole} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Browse Products',
role: 'Admin Integration'
}),
addPermissionToRole({
permission: 'Read Products',
role: 'Admin Integration'
}),
addPermissionToRole({
permission: 'Edit Products',
role: 'Admin Integration'
}),
addPermissionToRole({
permission: 'Add Products',
role: 'Admin Integration'
})
);

View File

@ -668,7 +668,9 @@
"label": "all",
"email_preview": "all",
"email": "all",
"snippet": "all"
"snippet": "all",
"product": ["browse", "read", "add", "edit"],
"offer": ["browse", "read", "add", "edit"]
},
"Editor": {
"notification": "all",

View File

@ -29,6 +29,8 @@ const notImplemented = function (req, res, next) {
users: ['GET'],
themes: ['POST', 'PUT'],
members: ['GET', 'PUT', 'DELETE', 'POST'],
tiers: ['GET', 'PUT', 'POST'],
offers: ['GET', 'PUT', 'POST'],
config: ['GET'],
schedules: ['PUT'],
files: ['POST'],

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 = 'b7867be4de694b4592d748c0367064b5';
const currentFixturesHash = '84be2bb1d62b384260b72ebfc20f81dc';
const currentFixturesHash = 'f4dd2a454e1999b6d149cc26ae52ced4';
const currentSettingsHash = '71fa38d0c805c18ceebe0fda80886230';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';