Fixed the newsletters api permissions (#14458)

refs https://github.com/TryGhost/Team/issues/1504

- The permissions were missing in the fixture file
- This caused some Ghost installs to not have the right permissions
- This is fixed by adding the missing permissions to the fixture file and creating a migration to resolve the missing permissions
This commit is contained in:
Thibaut Patel 2022-04-13 12:02:06 +02:00 committed by GitHub
parent 4c2bcba5f0
commit ffc57301f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 2 deletions

View File

@ -0,0 +1,33 @@
const {
addPermissionWithRoles,
combineTransactionalMigrations
} = require('../../utils');
/**
* This is similar to core/server/data/migrations/versions/4.42/2022-03-30-15-44-add-newsletter-permissions.js
* as the permissions were not added in the fixture file at the time of the migration.
* This means the new Ghost installs do not have the newsletter permission and we need this migration.
*/
module.exports = combineTransactionalMigrations(
addPermissionWithRoles({
name: 'Browse newsletters',
action: 'browse',
object: 'newsletter'
}, [
'Administrator'
]),
addPermissionWithRoles({
name: 'Add newsletters',
action: 'add',
object: 'newsletter'
}, [
'Administrator'
]),
addPermissionWithRoles({
name: 'Edit newsletters',
action: 'edit',
object: 'newsletter'
}, [
'Administrator'
])
);

View File

@ -541,6 +541,21 @@
"name": "Edit custom theme settings",
"action_type": "edit",
"object_type": "custom_theme_setting"
},
{
"name": "Browse newsletters",
"action_type": "browse",
"object_type": "newsletter"
},
{
"name": "Add newsletters",
"action_type": "add",
"object_type": "newsletter"
},
{
"name": "Edit newsletters",
"action_type": "edit",
"object_type": "newsletter"
}
]
},
@ -652,7 +667,8 @@
"custom_theme_setting": "all",
"offer": "all",
"authentication": "resetAllPasswords",
"members_stripe_connect": "auth"
"members_stripe_connect": "auth",
"newsletter": "all"
},
"DB Backup Integration": {
"db": "all"

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 = 'ff2c43dc264d712397a912e9709a0410';
const currentFixturesHash = 'dcc81e94da6fb9d96becf208cfa5bc73';
const currentFixturesHash = 'a08bedf7a552498ed6f4a0d72c732dd5';
const currentSettingsHash = '71fa38d0c805c18ceebe0fda80886230';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';