allow access to admin users that don't belong to the requested account.
this is also necessary for multisite, where requests are forwarded to
the metadata master as the multisite system user instead of the original
requester
Signed-off-by: Casey Bodley <cbodley@redhat.com>
return -EINVAL;
}
- const auto& account = s->auth.identity->get_account();
- if (!account) {
- return -ERR_METHOD_NOT_ALLOWED;
- }
- if (account_id != account->id) {
- s->err.message = "x-amz-account-id must match the requester";
- return -EINVAL;
+ if (!s->auth.identity->is_admin()) {
+ // verify that the requester belongs to the specified account
+ const auto& account = s->auth.identity->get_account();
+ if (!account) {
+ return -ERR_METHOD_NOT_ALLOWED;
+ }
+ if (account_id != account->id) {
+ s->err.message = "x-amz-account-id must match the requester";
+ return -EINVAL;
+ }
}
return 0;
}