const std::string& tenant = s->auth.identity->get_tenant();
int r = driver->load_account_user_by_name(this, y, account_id,
tenant, username, &user);
- if (r == -ENOENT) {
+ // root user is hidden from user apis
+ const bool is_root = (user && user->get_type() == TYPE_ROOT);
+ if (r == -ENOENT || is_root) {
s->err.message = "No such UserName in the account";
return -ERR_NO_SUCH_ENTITY;
}
const std::string& tenant = s->auth.identity->get_tenant();
int r = driver->load_account_user_by_name(this, y, account_id,
tenant, username, &user);
- if (r == -ENOENT) {
+ // root user is hidden from user apis
+ const bool is_root = (user && user->get_type() == TYPE_ROOT);
+ if (r == -ENOENT || is_root) {
s->err.message = "No such UserName in the account";
return -ERR_NO_SUCH_ENTITY;
}
const std::string& tenant = s->auth.identity->get_tenant();
int r = driver->load_account_user_by_name(this, y, account_id,
tenant, username, &user);
- if (r == -ENOENT) {
+ // root user is hidden from user apis
+ const bool is_root = (user && user->get_type() == TYPE_ROOT);
+ if (r == -ENOENT || is_root) {
s->err.message = "No such UserName in the account";
return -ERR_NO_SUCH_ENTITY;
}
}
for (const auto& info : users) {
+ if (info.type == TYPE_ROOT) {
+ continue; // root user is hidden from user apis
+ }
s->formatter->open_object_section("member");
dump_iam_user(info, s->formatter);
s->formatter->close_section(); // member
const std::string& tenant = s->auth.identity->get_tenant();
int r = driver->load_account_user_by_name(this, y, account_id,
tenant, username, &user);
- if (r == -ENOENT) {
+ // root user is hidden from user apis
+ const bool is_root = (user && user->get_type() == TYPE_ROOT);
+ if (r == -ENOENT || is_root) {
s->err.message = "No such UserName in the account";
return -ERR_NO_SUCH_ENTITY;
}
const std::string& tenant = s->auth.identity->get_tenant();
int r = driver->load_account_user_by_name(this, y, account_id,
tenant, username, &user);
- if (r == -ENOENT) {
+ // root user is hidden from user apis
+ const bool is_root = (user && user->get_type() == TYPE_ROOT);
+ if (r == -ENOENT || is_root) {
s->err.message = "No such UserName in the account";
return -ERR_NO_SUCH_ENTITY;
}
const std::string& tenant = s->auth.identity->get_tenant();
int r = driver->load_account_user_by_name(this, y, account_id,
tenant, username, &user);
- if (r == -ENOENT) {
+ // root user is hidden from user apis
+ const bool is_root = (user && user->get_type() == TYPE_ROOT);
+ if (r == -ENOENT || is_root) {
s->err.message = "No such UserName in the account";
return -ERR_NO_SUCH_ENTITY;
}
const std::string& tenant = s->auth.identity->get_tenant();
r = driver->load_account_user_by_name(this, y, account_id,
tenant, username, &user);
- if (r == -ENOENT) {
+ // root user is hidden from user apis
+ const bool is_root = (user && user->get_type() == TYPE_ROOT);
+ if (r == -ENOENT || is_root) {
return -ERR_NO_SUCH_ENTITY;
}
return r;