const std::vector<std::string>& admin_roles
) const noexcept
{
+ using acct_privilege_t = RGWRemoteAuthApplier::AuthInfo::acct_privilege_t;
+
/* Check whether the user has an admin status. */
- bool is_admin = false;
+ acct_privilege_t level = acct_privilege_t::IS_PLAIN_ACCT;
for (const auto& admin_role : admin_roles) {
if (token.has_role(admin_role)) {
- is_admin = true;
+ level = acct_privilege_t::IS_ADMIN_ACCT;
break;
}
}
/* Keystone doesn't support RGW's subuser concept, so we cannot cut down
* the access rights through the perm_mask. At least at this layer. */
RGW_PERM_FULL_CONTROL,
- is_admin,
+ level,
};
}
const uint32_t acct_type;
public:
+ enum class acct_privilege_t {
+ IS_ADMIN_ACCT,
+ IS_PLAIN_ACCT
+ };
+
AuthInfo(const rgw_user& acct_user,
const std::string& acct_name,
const uint32_t perm_mask,
- const bool is_admin,
+ const acct_privilege_t level,
const uint32_t acct_type=TYPE_NONE)
: acct_user(acct_user),
acct_name(acct_name),
perm_mask(perm_mask),
- is_admin(is_admin),
+ is_admin(acct_privilege_t::IS_ADMIN_ACCT == level),
acct_type(acct_type) {
}
};
RGWRemoteAuthApplier::AuthInfo
RGWLDAPAuthEngine::get_creds_info(const rgw::RGWToken& token) const noexcept
{
+ using acct_privilege_t = RGWRemoteAuthApplier::AuthInfo::acct_privilege_t;
+
return RGWRemoteAuthApplier::AuthInfo {
rgw_user(token.id),
token.id,
RGW_PERM_FULL_CONTROL,
- false,
+ acct_privilege_t::IS_PLAIN_ACCT,
TYPE_LDAP
};
}