mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-14 11:05:50 +03:00
Added migration for Ghost Explore permissions
- this adds permissions so the Ghost Explore integration has permission to access the `/explore/` endpoint
This commit is contained in:
parent
3747df1bc8
commit
6d521cc14c
@ -0,0 +1,11 @@
|
||||
const {addPermissionWithRoles} = require('../../utils');
|
||||
|
||||
module.exports = addPermissionWithRoles({
|
||||
name: 'Read explore data',
|
||||
action: 'read',
|
||||
object: 'explore'
|
||||
}, [
|
||||
'Administrator',
|
||||
'Admin Integration',
|
||||
'Ghost Explore Integration'
|
||||
]);
|
@ -86,6 +86,11 @@
|
||||
{
|
||||
"name": "Permission",
|
||||
"entries": [
|
||||
{
|
||||
"name": "Read explore data",
|
||||
"action_type": "read",
|
||||
"object_type": "explore"
|
||||
},
|
||||
{
|
||||
"name": "Export database",
|
||||
"action_type": "exportContent",
|
||||
@ -689,7 +694,8 @@
|
||||
"offer": "all",
|
||||
"authentication": "resetAllPasswords",
|
||||
"members_stripe_connect": "auth",
|
||||
"newsletter": "all"
|
||||
"newsletter": "all",
|
||||
"explore": "read"
|
||||
},
|
||||
"DB Backup Integration": {
|
||||
"db": "all"
|
||||
@ -697,6 +703,9 @@
|
||||
"Scheduler Integration": {
|
||||
"post": "publish"
|
||||
},
|
||||
"Ghost Explore Integration": {
|
||||
"explore": "read"
|
||||
},
|
||||
"Admin Integration": {
|
||||
"mail": "all",
|
||||
"notification": "all",
|
||||
@ -718,7 +727,8 @@
|
||||
"snippet": "all",
|
||||
"product": ["browse", "read", "add", "edit"],
|
||||
"offer": ["browse", "read", "add", "edit"],
|
||||
"newsletter": ["browse", "read", "add", "edit"]
|
||||
"newsletter": ["browse", "read", "add", "edit"],
|
||||
"explore": "read"
|
||||
},
|
||||
"Editor": {
|
||||
"notification": "all",
|
||||
|
@ -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(96);
|
||||
permissions.length.should.eql(97);
|
||||
|
||||
permissions.should.havePermission('Export database', ['Administrator', 'DB Backup Integration']);
|
||||
permissions.should.havePermission('Import database', ['Administrator', 'DB Backup Integration']);
|
||||
@ -167,6 +167,8 @@ describe('Database Migration (special functions)', function () {
|
||||
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']);
|
||||
|
||||
permissions.should.havePermission('Read explore data', ['Administrator', 'Admin Integration', 'Ghost Explore Integration']);
|
||||
});
|
||||
|
||||
describe('Populate', function () {
|
||||
@ -225,7 +227,7 @@ describe('Database Migration (special functions)', function () {
|
||||
result.roles.at(8).get('name').should.eql('Scheduler Integration');
|
||||
|
||||
// Permissions
|
||||
result.permissions.length.should.eql(96);
|
||||
result.permissions.length.should.eql(97);
|
||||
result.permissions.toJSON().should.be.CompletePermissions();
|
||||
});
|
||||
});
|
||||
|
@ -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', 89);
|
||||
result.should.have.property('done', 89);
|
||||
result.should.have.property('expected', 92);
|
||||
result.should.have.property('done', 92);
|
||||
|
||||
// Permissions & Roles
|
||||
permsAllStub.calledOnce.should.be.true();
|
||||
rolesAllStub.calledOnce.should.be.true();
|
||||
dataMethodStub.filter.callCount.should.eql(89);
|
||||
dataMethodStub.find.callCount.should.eql(7);
|
||||
baseUtilAttachStub.callCount.should.eql(89);
|
||||
dataMethodStub.filter.callCount.should.eql(92);
|
||||
dataMethodStub.find.callCount.should.eql(8);
|
||||
baseUtilAttachStub.callCount.should.eql(92);
|
||||
|
||||
fromItem.related.callCount.should.eql(89);
|
||||
fromItem.find.callCount.should.eql(89);
|
||||
fromItem.related.callCount.should.eql(92);
|
||||
fromItem.find.callCount.should.eql(92);
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
@ -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 = 'b9103927f61cfc9aab2784e402b58a34';
|
||||
const currentFixturesHash = '1d6562a1963a9b9d10d06070d537f11f';
|
||||
const currentSettingsHash = '0b138cdd40e48b5b7dc4ebac2a7819a7';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
||||
|
@ -86,6 +86,11 @@
|
||||
{
|
||||
"name": "Permission",
|
||||
"entries": [
|
||||
{
|
||||
"name": "Read explore data",
|
||||
"action_type": "read",
|
||||
"object_type": "explore"
|
||||
},
|
||||
{
|
||||
"name": "Export database",
|
||||
"action_type": "exportContent",
|
||||
@ -862,7 +867,8 @@
|
||||
"offer": "all",
|
||||
"authentication": "resetAllPasswords",
|
||||
"members_stripe_connect": "auth",
|
||||
"newsletter": "all"
|
||||
"newsletter": "all",
|
||||
"explore": "read"
|
||||
},
|
||||
"DB Backup Integration": {
|
||||
"db": "all"
|
||||
@ -870,6 +876,9 @@
|
||||
"Scheduler Integration": {
|
||||
"post": "publish"
|
||||
},
|
||||
"Ghost Explore Integration": {
|
||||
"explore": "read"
|
||||
},
|
||||
"Admin Integration": {
|
||||
"mail": "all",
|
||||
"notification": "all",
|
||||
@ -891,7 +900,8 @@
|
||||
"snippet": "all",
|
||||
"product": ["browse", "read", "add", "edit"],
|
||||
"offer": ["browse", "read", "add", "edit"],
|
||||
"newsletter": ["browse", "read", "add", "edit"]
|
||||
"newsletter": ["browse", "read", "add", "edit"],
|
||||
"explore": "read"
|
||||
},
|
||||
"Editor": {
|
||||
"notification": "all",
|
||||
|
Loading…
Reference in New Issue
Block a user