diff --git a/core/server/data/migrations/versions/4.45/2022-04-20-11-25-add-newsletter-read-permission.js b/core/server/data/migrations/versions/4.45/2022-04-20-11-25-add-newsletter-read-permission.js new file mode 100644 index 0000000000..7b0b8234d6 --- /dev/null +++ b/core/server/data/migrations/versions/4.45/2022-04-20-11-25-add-newsletter-read-permission.js @@ -0,0 +1,9 @@ +const {addPermissionWithRoles} = require('../../utils'); + +module.exports = addPermissionWithRoles({ + name: 'Read newsletters', + action: 'read', + object: 'newsletter' +}, [ + 'Administrator' +]); diff --git a/core/server/data/schema/fixtures/fixtures.json b/core/server/data/schema/fixtures/fixtures.json index 5518ed22a4..333c3f9366 100644 --- a/core/server/data/schema/fixtures/fixtures.json +++ b/core/server/data/schema/fixtures/fixtures.json @@ -546,6 +546,11 @@ "action_type": "browse", "object_type": "newsletter" }, + { + "name": "Read newsletters", + "action_type": "read", + "object_type": "newsletter" + }, { "name": "Add newsletters", "action_type": "add", diff --git a/test/integration/migrations/migration.test.js b/test/integration/migrations/migration.test.js index ee3d170a7a..bb81f322f3 100644 --- a/test/integration/migrations/migration.test.js +++ b/test/integration/migrations/migration.test.js @@ -45,7 +45,7 @@ describe('Database Migration (special functions)', function () { const permissions = this.obj; // If you have to change this number, please add the relevant `havePermission` checks below - permissions.length.should.eql(95); + permissions.length.should.eql(96); permissions.should.havePermission('Export database', ['Administrator', 'DB Backup Integration']); permissions.should.havePermission('Import database', ['Administrator', 'DB Backup Integration']); @@ -164,6 +164,7 @@ describe('Database Migration (special functions)', function () { permissions.should.havePermission('Edit custom theme settings', ['Administrator']); permissions.should.havePermission('Browse newsletters', ['Administrator']); + permissions.should.havePermission('Read newsletters', ['Administrator']); permissions.should.havePermission('Edit newsletters', ['Administrator']); permissions.should.havePermission('Add newsletters', ['Administrator']); }); @@ -223,7 +224,7 @@ describe('Database Migration (special functions)', function () { result.roles.at(7).get('name').should.eql('Scheduler Integration'); // Permissions - result.permissions.length.should.eql(95); + result.permissions.length.should.eql(96); result.permissions.toJSON().should.be.CompletePermissions(); }); }); diff --git a/test/unit/server/data/schema/integrity.test.js b/test/unit/server/data/schema/integrity.test.js index 5a44ec57f0..c800827a63 100644 --- a/test/unit/server/data/schema/integrity.test.js +++ b/test/unit/server/data/schema/integrity.test.js @@ -36,7 +36,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route describe('DB version integrity', function () { // Only these variables should need updating const currentSchemaHash = 'ae71340a8c89f6580b2eb06101f003b4'; - const currentFixturesHash = '2fb171312dfdd1dc3a569dfb845ac6f5'; + const currentFixturesHash = '2fe576bcde3428c3063c05b2f2c37367'; const currentSettingsHash = '71fa38d0c805c18ceebe0fda80886230'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01'; diff --git a/test/utils/fixtures/fixtures.json b/test/utils/fixtures/fixtures.json index bdc382f9cc..e9832dc7a6 100644 --- a/test/utils/fixtures/fixtures.json +++ b/test/utils/fixtures/fixtures.json @@ -107,6 +107,11 @@ "action_type": "browse", "object_type": "notification" }, + { + "name": "Read newsletters", + "action_type": "read", + "object_type": "newsletter" + }, { "name": "Add notifications", "action_type": "add",