Added newsletter permissions for Editors and Authors

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

- Editors and Authors require read access to newsletters as part of the publish + send workflow
This commit is contained in:
Matt Hanley 2022-05-12 11:32:30 +01:00 committed by Matt Hanley
parent 78d1132b13
commit 1fabd76391
6 changed files with 37 additions and 13 deletions

View File

@ -0,0 +1,20 @@
const {combineTransactionalMigrations, addPermissionToRole} = require('../../utils');
module.exports = combineTransactionalMigrations(
addPermissionToRole({
permission: 'Browse newsletters',
role: 'Editor'
}),
addPermissionToRole({
permission: 'Read newsletters',
role: 'Editor'
}),
addPermissionToRole({
permission: 'Browse newsletters',
role: 'Author'
}),
addPermissionToRole({
permission: 'Read newsletters',
role: 'Author'
})
);

View File

@ -723,7 +723,8 @@
"email": "all",
"snippet": "all",
"label": ["browse", "read"],
"product": ["browse", "read"]
"product": ["browse", "read"],
"newsletter": ["browse", "read"]
},
"Author": {
"post": ["browse", "read", "add"],
@ -736,7 +737,8 @@
"email_preview": "read",
"email": "read",
"snippet": ["browse", "read"],
"product": ["browse", "read"]
"product": ["browse", "read"],
"newsletter": ["browse", "read"]
},
"Contributor": {
"post": ["browse", "read", "add"],

View File

@ -163,8 +163,8 @@ describe('Database Migration (special functions)', function () {
permissions.should.havePermission('Browse custom theme settings', ['Administrator']);
permissions.should.havePermission('Edit custom theme settings', ['Administrator']);
permissions.should.havePermission('Browse newsletters', ['Administrator', 'Admin Integration']);
permissions.should.havePermission('Read newsletters', ['Administrator', 'Admin Integration']);
permissions.should.havePermission('Browse newsletters', ['Administrator', 'Editor', 'Author', 'Admin Integration']);
permissions.should.havePermission('Read newsletters', ['Administrator', 'Editor', 'Author', 'Admin Integration']);
permissions.should.havePermission('Edit newsletters', ['Administrator', 'Admin Integration']);
permissions.should.havePermission('Add newsletters', ['Administrator', 'Admin Integration']);
});

View File

@ -201,18 +201,18 @@ describe('Migration Fixture Utils', function () {
fixtureManager.addFixturesForRelation(fixtures.relations[0]).then(function (result) {
should.exist(result);
result.should.be.an.Object();
result.should.have.property('expected', 86);
result.should.have.property('done', 86);
result.should.have.property('expected', 88);
result.should.have.property('done', 88);
// Permissions & Roles
permsAllStub.calledOnce.should.be.true();
rolesAllStub.calledOnce.should.be.true();
dataMethodStub.filter.callCount.should.eql(86);
dataMethodStub.filter.callCount.should.eql(88);
dataMethodStub.find.callCount.should.eql(7);
baseUtilAttachStub.callCount.should.eql(86);
baseUtilAttachStub.callCount.should.eql(88);
fromItem.related.callCount.should.eql(86);
fromItem.find.callCount.should.eql(86);
fromItem.related.callCount.should.eql(88);
fromItem.find.callCount.should.eql(88);
done();
}).catch(done);

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 = '2f4266e6e5087ad92dd30f3e721d46e5';
const currentFixturesHash = 'f4795020369ec3a770b538be8d8b2536';
const currentFixturesHash = '2219972fb91a30f8d740e05afd3a033c';
const currentSettingsHash = 'ffd899a82b0ad2886e92d8244bcbca6a';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';

View File

@ -896,7 +896,8 @@
"email": "all",
"snippet": "all",
"label": ["browse", "read"],
"product": ["browse", "read"]
"product": ["browse", "read"],
"newsletter": ["browse", "read"]
},
"Author": {
"post": ["browse", "read", "add"],
@ -909,7 +910,8 @@
"email_preview": "read",
"email": "read",
"snippet": ["browse", "read"],
"product": ["browse", "read"]
"product": ["browse", "read"],
"newsletter": ["browse", "read"]
},
"Contributor": {
"post": ["browse", "read", "add"],