mirror of
https://github.com/TryGhost/Ghost.git
synced 2023-12-13 21:00:40 +01:00
Updated frame.context to use req.api_key_id (#9965)
* Added api_key_id to frame.context refs #9865 This is to allow controllers to check permissions using api_key_id data. * Removed client and client_id from frame.context refs #9865 This is unused as we only support oauth on v0.1 API.
This commit is contained in:
parent
23e9a02ff1
commit
1b9aa2546f
2 changed files with 4 additions and 6 deletions
|
@ -14,9 +14,8 @@ const http = (apiImpl) => {
|
|||
params: req.params,
|
||||
user: req.user,
|
||||
context: {
|
||||
user: ((req.user && req.user.id) || (req.user && models.User.isExternalUser(req.user.id))) ? req.user.id : null,
|
||||
client: (req.client && req.client.slug) ? req.client.slug : null,
|
||||
client_id: (req.client && req.client.id) ? req.client.id : null
|
||||
api_key_id: (req.api_key && req.api_key.id) ? req.api_key.id : null,
|
||||
user: ((req.user && req.user.id) || (req.user && models.User.isExternalUser(req.user.id))) ? req.user.id : null
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -45,9 +45,8 @@ describe('Unit: api/shared/http', function () {
|
|||
apiImpl.args[0][0].data.should.eql({a: 'a'});
|
||||
apiImpl.args[0][0].options.should.eql({
|
||||
context: {
|
||||
user: null,
|
||||
client: null,
|
||||
client_id: null
|
||||
api_key_id: null,
|
||||
user: null
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue