diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-02 21:05:21 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-05-02 22:08:37 -0700 |
commit | aab390529df56cabc75cc8fff2707b32c35aaaec (patch) | |
tree | 566c87c77e022fc657408faab598ab56c1b130c6 /src/rgw/rgw_admin.cc | |
parent | debbc79e2756a48636508d43941976531df68f23 (diff) | |
download | ceph-wip-4716.tar.gz |
rgw: user operation maskwip-4716
Fixes: #4716
add user operation mask for controlling user permissions.
Also add admin controls for it.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Diffstat (limited to 'src/rgw/rgw_admin.cc')
-rw-r--r-- | src/rgw/rgw_admin.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 9804761e8ab..edbe887c208 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -485,6 +485,7 @@ int main(int argc, char **argv) std::string infile; RGWUserAdminOpState user_op; RGWBucketAdminOpState bucket_op; + string op_mask_str; std::string val; std::ostringstream errs; @@ -513,6 +514,8 @@ int main(int argc, char **argv) pool_name = val; } else if (ceph_argparse_witharg(args, i, &val, "-o", "--object", (char*)NULL)) { object = val; + } else if (ceph_argparse_witharg(args, i, &val, "--op-mask", (char*)NULL)) { + op_mask_str = val; } else if (ceph_argparse_witharg(args, i, &val, "--key-type", (char*)NULL)) { key_type_str = val; if (key_type_str.compare("swift") == 0) { @@ -677,6 +680,17 @@ int main(int argc, char **argv) if (set_perm) user_op.set_perm(perm_mask); + if (!op_mask_str.empty()) { + uint32_t op_mask; + int ret = rgw_parse_op_type_list(op_mask_str, &op_mask); + if (ret < 0) { + cerr << "failed to parse op_mask: " << cpp_strerror(-ret) << std::endl; + return -ret; + } + + user_op.set_op_mask(op_mask); + } + if (key_type != KEY_TYPE_UNDEFINED) user_op.set_key_type(key_type); |