mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Don't allow updates to title when PUTting index-patterns
This commit is contained in:
parent
68d3be8b8d
commit
526e8e7e74
2 changed files with 15 additions and 0 deletions
|
@ -171,6 +171,9 @@ export default function (server) {
|
|||
path: '/api/index-patterns/{id}',
|
||||
method: 'PUT',
|
||||
handler: function (req, reply) {
|
||||
if (_.isEmpty(req.payload)) { return reply(Boom.badRequest('Payload required')); }
|
||||
if (req.payload.title !== req.params.id) { return reply(Boom.badRequest('Updates to title not supported')); }
|
||||
|
||||
let client = server.plugins.elasticsearch.client;
|
||||
const indexPattern = _.cloneDeep(req.payload);
|
||||
const isWildcard = _.contains(indexPattern.title, '*') || (indexPattern.title.match(/\[.*]/) !== null);
|
||||
|
|
|
@ -38,6 +38,18 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
bdd.it('should return 400 if you try to modify the title', function () {
|
||||
var pattern = createTestData().indexPatternWithMappings;
|
||||
pattern.fields = _.map(pattern.fields, function (field) {
|
||||
return _.omit(field, 'mapping');
|
||||
});
|
||||
pattern.title = 'foo';
|
||||
|
||||
return request.put('/index-patterns/logstash-*')
|
||||
.send(pattern)
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue