MXS-2574: Add PATCH for /users/inet endpoint

The alteration of user passwords is now done inside MaxScale. This
prevents the possibility of a user locking themselves out.
This commit is contained in:
Markus Mäkelä
2019-06-24 14:44:11 +03:00
parent 77671a2393
commit aac0ecc373
9 changed files with 115 additions and 13 deletions

View File

@ -192,10 +192,6 @@ exports.builder = function(yargs) {
}, function(argv) {
maxctrl(argv, function(host) {
if (argv.u == argv.name) {
return error('Cannot alter current user')
}
var user = {
'data': {
'id': argv.name,
@ -206,10 +202,7 @@ exports.builder = function(yargs) {
}
}
return getJson(host, 'users/inet/' + argv.name)
.then((res) => user.data.attributes.account = res.data.attributes.account)
.then(() => doRequest(host, 'users/inet/' + argv.name, null, {method: 'DELETE'}))
.then(() => doRequest(host, 'users/inet', null, {method: 'POST', body: user}))
return doRequest(host, 'users/inet/' + argv.name, null, {method: 'PATCH', body: user})
})
})
.usage('Usage: alter <command>')