This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
forked from RadoslavGatev/Ghost-Azure
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
1,338 additions
and
587 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...dark-8489624c8061bd056eb0c1af7e4a2d9e.css → ...dark-3da2f60160cd5249294a3758d1a63bd0.css
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
....min-583b94b8d9b97dee28f64db3ef6e0e54.css → ....min-05715c59881dec3c389064248b0b00b6.css
Large diffs are not rendered by default.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...t.min-58a92d0509af303859acd55b0c67a428.js → ...t.min-bb695142973ac2d4f4b19a8a79e9824f.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const models = require('../../models'); | ||
|
||
module.exports = { | ||
docName: 'actions', | ||
|
||
browse: { | ||
options: [ | ||
'page', | ||
'limit', | ||
'fields' | ||
], | ||
data: [ | ||
'id', | ||
'type' | ||
], | ||
validation: { | ||
id: { | ||
required: true | ||
}, | ||
type: { | ||
required: true, | ||
values: ['resource', 'actor'] | ||
} | ||
}, | ||
permissions: true, | ||
query(frame) { | ||
if (frame.data.type === 'resource') { | ||
frame.options.withRelated = ['actor']; | ||
frame.options.filter = `resource_id:${frame.data.id}`; | ||
} else { | ||
frame.options.withRelated = ['resource']; | ||
frame.options.filter = `actor_id:${frame.data.id}`; | ||
} | ||
|
||
return models.Action.findPage(frame.options); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const debug = require('ghost-ignition').debug('api:v2:utils:serializers:output:actions'); | ||
const mapper = require('./utils/mapper'); | ||
|
||
module.exports = { | ||
browse(models, apiConfig, frame) { | ||
debug('browse'); | ||
|
||
frame.response = { | ||
actions: models.data.map(model => mapper.mapAction(model, frame)), | ||
meta: models.meta | ||
}; | ||
|
||
debug(frame.response); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
core/server/data/migrations/versions/2.14/1-add-actions-table.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const common = require('../../../../lib/common'); | ||
const commands = require('../../../schema').commands; | ||
const table = 'actions'; | ||
const message1 = `Adding table: ${table}`; | ||
const message2 = `Dropping table: ${table}`; | ||
|
||
module.exports.up = (options) => { | ||
const connection = options.connection; | ||
|
||
return connection.schema.hasTable(table) | ||
.then(function (exists) { | ||
if (exists) { | ||
common.logging.warn(message1); | ||
return; | ||
} | ||
|
||
common.logging.info(message1); | ||
return commands.createTable(table, connection); | ||
}); | ||
}; | ||
|
||
module.exports.down = (options) => { | ||
const connection = options.connection; | ||
|
||
return connection.schema.hasTable(table) | ||
.then(function (exists) { | ||
if (!exists) { | ||
common.logging.warn(message2); | ||
return; | ||
} | ||
|
||
common.logging.info(message2); | ||
return commands.deleteTable(table, connection); | ||
}); | ||
}; |
47 changes: 47 additions & 0 deletions
47
core/server/data/migrations/versions/2.14/2-add-actions-permissions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const _ = require('lodash'); | ||
const utils = require('../../../schema/fixtures/utils'); | ||
const permissions = require('../../../../services/permissions'); | ||
const common = require('../../../../lib/common'); | ||
const resource = 'action'; | ||
const _private = {}; | ||
|
||
_private.getPermissions = function getPermissions() { | ||
return utils.findModelFixtures('Permission', {object_type: resource}); | ||
}; | ||
|
||
_private.getRelations = function getRelations() { | ||
return utils.findPermissionRelationsForObject(resource); | ||
}; | ||
|
||
_private.printResult = function printResult(result, message) { | ||
if (result.done === result.expected) { | ||
common.logging.info(message); | ||
} else { | ||
common.logging.warn('(' + result.done + '/' + result.expected + ') ' + message); | ||
} | ||
}; | ||
|
||
module.exports.config = { | ||
transaction: true | ||
}; | ||
|
||
module.exports.up = function addRedirectsPermissions(options) { | ||
const modelToAdd = _private.getPermissions(); | ||
const relationToAdd = _private.getRelations(); | ||
const localOptions = _.merge({ | ||
context: { | ||
internal: true, | ||
migrating: true | ||
} | ||
}, options); | ||
|
||
return utils.addFixturesForModel(modelToAdd, localOptions) | ||
.then(function (result) { | ||
_private.printResult(result, 'Adding permissions fixtures for ' + resource + 's'); | ||
return utils.addFixturesForRelation(relationToAdd, localOptions); | ||
}) | ||
.then(function (result) { | ||
_private.printResult(result, 'Adding permissions_roles fixtures for ' + resource + 's'); | ||
return permissions.init(localOptions); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.