Added permissions for link edit endpoints (#15664)

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

- adds edit permissions for links endpoints to fixtures
- new `bulkEdit` endpoint will use the permissions and allow fixing newsletter links via Admin
This commit is contained in:
Rishabh Garg 2022-10-20 09:11:26 +05:30 committed by GitHub
parent 14dfd618c3
commit 318a5a809c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 2 deletions

View File

@ -0,0 +1,10 @@
const {addPermissionWithRoles} = require('../../utils');
module.exports = addPermissionWithRoles({
name: 'Edit links',
action: 'edit',
object: 'link'
}, [
'Administrator',
'Admin Integration'
]);

View File

@ -623,6 +623,11 @@
"name": "Browse links", "name": "Browse links",
"action_type": "browse", "action_type": "browse",
"object_type": "link" "object_type": "link"
},
{
"name": "Edit links",
"action_type": "edit",
"object_type": "link"
} }
] ]
}, },

View File

@ -45,7 +45,7 @@ describe('Database Migration (special functions)', function () {
const permissions = this.obj; const permissions = this.obj;
// If you have to change this number, please add the relevant `havePermission` checks below // If you have to change this number, please add the relevant `havePermission` checks below
permissions.length.should.eql(107); permissions.length.should.eql(108);
permissions.should.havePermission('Export database', ['Administrator', 'DB Backup Integration']); permissions.should.havePermission('Export database', ['Administrator', 'DB Backup Integration']);
permissions.should.havePermission('Import database', ['Administrator', 'DB Backup Integration']); permissions.should.havePermission('Import database', ['Administrator', 'DB Backup Integration']);

View File

@ -36,7 +36,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
describe('DB version integrity', function () { describe('DB version integrity', function () {
// Only these variables should need updating // Only these variables should need updating
const currentSchemaHash = '76cfd2230c02c428e9505f6b9a3936ec'; const currentSchemaHash = '76cfd2230c02c428e9505f6b9a3936ec';
const currentFixturesHash = '6110a18edb75e3b7465d69385915984d'; const currentFixturesHash = 'dcb7ba7c66b4b98d6c26a722985e756a';
const currentSettingsHash = '2978a5684a2d5fcf089f61f5d368a0c0'; const currentSettingsHash = '2978a5684a2d5fcf089f61f5d368a0c0';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';

View File

@ -623,6 +623,11 @@
"name": "Browse links", "name": "Browse links",
"action_type": "browse", "action_type": "browse",
"object_type": "link" "object_type": "link"
},
{
"name": "Edit links",
"action_type": "edit",
"object_type": "link"
} }
] ]
}, },