++i;
}
}
- if (tenant.empty()) {
- tenant = user_id.tenant;
- } else {
- if (user_id.empty()) {
- cerr << "ERROR: --tenant is set, but there's no user ID" << std::endl;
- return EINVAL;
- }
- user_id.tenant = tenant;
- }
if (args.empty()) {
return usage();
}
}
+ if (tenant.empty()) {
+ tenant = user_id.tenant;
+ } else {
+ if (user_id.empty() && opt_cmd != OPT_ROLE_CREATE) {
+ cerr << "ERROR: --tenant is set, but there's no user ID" << std::endl;
+ return EINVAL;
+ }
+ user_id.tenant = tenant;
+ }
/* check key parameter conflict */
if ((!access_key.empty()) && gen_access_key) {
cerr << "ERROR: key parameter conflict, --access-key & --gen-access-key" << std::endl;
return 0;
case OPT_ROLE_CREATE:
{
- string uid;
- user_id.to_str(uid);
- if (role_name.empty() || assume_role_doc.empty() || uid.empty()) {
- cerr << "ERROR: one of role name or assume role policy document or uid is empty" << std::endl;
+ if (role_name.empty() || assume_role_doc.empty()) {
+ cerr << "ERROR: one of role name or assume role policy document is empty" << std::endl;
return -EINVAL;
}
/* The following two calls will be replaced by read_decode_json or something
return -EINVAL;
}
string trust_policy = bl.to_str();
- RGWRole role(g_ceph_context, store, role_name, path, trust_policy, uid);
+ RGWRole role(g_ceph_context, store, role_name, path, trust_policy, tenant);
ret = role.create(true);
if (ret < 0) {
return -ret;
if (op_ret < 0) {
return;
}
- string uid;
- s->user->user_id.to_str(uid);
- RGWRole role(s->cct, store, role_name, role_path, trust_policy, uid);
+ RGWRole role(s->cct, store, role_name, role_path, trust_policy, s->user->user_id.tenant);
op_ret = role.create(true);
if (op_ret == -EEXIST) {
string creation_date;
string trust_policy;
map<string, string> perm_policy_map;
- string uid;
+ string tenant;
int store_info(bool exclusive);
int store_name(bool exclusive);
string name,
string path,
string trust_policy,
- string uid)
+ string tenant)
: cct(cct),
store(store),
name(std::move(name)),
path(std::move(path)),
trust_policy(std::move(trust_policy)),
- uid(std::move(uid)) {
+ tenant(std::move(tenant)) {
if (this->path.empty())
this->path = "/";
}