Fix enabled admin users being shown as basic users

The enabled admins for the Linux users were shown as basic users. This was
caused by the separation of the two admin types.

Added tests that check that enabled Linux accounts show the correct type
in the output.
This commit is contained in:
Markus Mäkelä
2017-09-07 19:27:50 +03:00
parent a3402dfebf
commit d2b474e021
2 changed files with 18 additions and 2 deletions

View File

@ -29,7 +29,7 @@ describe("Enable/Disable Commands", function() {
it('enable account', function() {
return verifyCommand('enable account test', 'users/unix/test')
.should.be.fulfilled
.should.eventually.have.deep.property('data.attributes.account', 'basic')
})
it('disable account', function() {
@ -37,5 +37,15 @@ describe("Enable/Disable Commands", function() {
.should.be.fulfilled
})
it('enable admin account', function() {
return verifyCommand('enable account test --type=admin', 'users/unix/test')
.should.eventually.have.deep.property('data.attributes.account', 'admin')
})
it('disable admin account', function() {
return doCommand('disable account test')
.should.be.fulfilled
})
after(stopMaxScale)
});

View File

@ -178,7 +178,13 @@ static std::string path_from_type(enum user_type type)
json_t* admin_user_to_json(const char* host, const char* user, enum user_type type)
{
user_account_type account = admin_user_is_inet_admin(user) ? USER_ACCOUNT_ADMIN : USER_ACCOUNT_BASIC;
user_account_type account = USER_ACCOUNT_BASIC;
if ((type == USER_TYPE_INET && admin_user_is_inet_admin(user)) ||
(type == USER_TYPE_UNIX && admin_user_is_unix_admin(user)))
{
account = USER_ACCOUNT_ADMIN;
}
std::string path = path_from_type(type);
path += "/";
path += user;