1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "common/ceph_json.h"
8 #include "rgw_rest_user.h"
10 #include "include/str_list.h"
11 #include "include/assert.h"
13 #define dout_subsys ceph_subsys_rgw
15 class RGWOp_User_Info
: public RGWRESTOp
{
20 int check_caps(RGWUserCaps
& caps
) override
{
21 return caps
.check_cap("users", RGW_CAP_READ
);
24 void execute() override
;
26 const string
name() override
{ return "get_user_info"; }
29 void RGWOp_User_Info::execute()
31 RGWUserAdminOpState op_state
;
37 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
39 // if uid was not supplied in rest argument, error out now, otherwise we'll
40 // end up initializing anonymous user, for which keys.init will eventually
47 rgw_user
uid(uid_str
);
49 RESTArgs::get_bool(s
, "stats", false, &fetch_stats
);
51 RESTArgs::get_bool(s
, "sync", false, &sync_stats
);
53 op_state
.set_user_id(uid
);
54 op_state
.set_fetch_stats(fetch_stats
);
55 op_state
.set_sync_stats(sync_stats
);
57 http_ret
= RGWUserAdminOp_User::info(store
, op_state
, flusher
);
60 class RGWOp_User_Create
: public RGWRESTOp
{
63 RGWOp_User_Create() {}
65 int check_caps(RGWUserCaps
& caps
) override
{
66 return caps
.check_cap("users", RGW_CAP_WRITE
);
69 void execute() override
;
71 const string
name() override
{ return "create_user"; }
74 void RGWOp_User_Create::execute()
77 std::string display_name
;
79 std::string access_key
;
80 std::string secret_key
;
81 std::string key_type_str
;
83 std::string tenant_name
;
91 int32_t default_max_buckets
= s
->cct
->_conf
->rgw_user_max_buckets
;
93 RGWUserAdminOpState op_state
;
95 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
96 rgw_user
uid(uid_str
);
98 RESTArgs::get_string(s
, "display-name", display_name
, &display_name
);
99 RESTArgs::get_string(s
, "email", email
, &email
);
100 RESTArgs::get_string(s
, "access-key", access_key
, &access_key
);
101 RESTArgs::get_string(s
, "secret-key", secret_key
, &secret_key
);
102 RESTArgs::get_string(s
, "key-type", key_type_str
, &key_type_str
);
103 RESTArgs::get_string(s
, "user-caps", caps
, &caps
);
104 RESTArgs::get_string(s
, "tenant", tenant_name
, &tenant_name
);
105 RESTArgs::get_bool(s
, "generate-key", true, &gen_key
);
106 RESTArgs::get_bool(s
, "suspended", false, &suspended
);
107 RESTArgs::get_int32(s
, "max-buckets", default_max_buckets
, &max_buckets
);
108 RESTArgs::get_bool(s
, "system", false, &system
);
109 RESTArgs::get_bool(s
, "exclusive", false, &exclusive
);
111 if (!s
->user
->system
&& system
) {
112 ldout(s
->cct
, 0) << "cannot set system flag by non-system user" << dendl
;
117 if (!tenant_name
.empty()) {
118 uid
.tenant
= tenant_name
;
121 // TODO: validate required args are passed in. (for eg. uid and display_name here)
122 op_state
.set_user_id(uid
);
123 op_state
.set_display_name(display_name
);
124 op_state
.set_user_email(email
);
125 op_state
.set_caps(caps
);
126 op_state
.set_access_key(access_key
);
127 op_state
.set_secret_key(secret_key
);
129 if (!key_type_str
.empty()) {
130 int32_t key_type
= KEY_TYPE_UNDEFINED
;
131 if (key_type_str
.compare("swift") == 0)
132 key_type
= KEY_TYPE_SWIFT
;
133 else if (key_type_str
.compare("s3") == 0)
134 key_type
= KEY_TYPE_S3
;
136 op_state
.set_key_type(key_type
);
139 if (max_buckets
!= default_max_buckets
)
140 op_state
.set_max_buckets(max_buckets
);
142 if (s
->info
.args
.exists("suspended"))
143 op_state
.set_suspension(suspended
);
145 if (s
->info
.args
.exists("system"))
146 op_state
.set_system(system
);
148 if (s
->info
.args
.exists("exclusive"))
149 op_state
.set_exclusive(exclusive
);
152 op_state
.set_generate_key();
154 http_ret
= RGWUserAdminOp_User::create(store
, op_state
, flusher
);
157 class RGWOp_User_Modify
: public RGWRESTOp
{
160 RGWOp_User_Modify() {}
162 int check_caps(RGWUserCaps
& caps
) override
{
163 return caps
.check_cap("users", RGW_CAP_WRITE
);
166 void execute() override
;
168 const string
name() override
{ return "modify_user"; }
171 void RGWOp_User_Modify::execute()
174 std::string display_name
;
176 std::string access_key
;
177 std::string secret_key
;
178 std::string key_type_str
;
188 RGWUserAdminOpState op_state
;
190 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
191 rgw_user
uid(uid_str
);
193 RESTArgs::get_string(s
, "display-name", display_name
, &display_name
);
194 RESTArgs::get_string(s
, "email", email
, &email
, &email_set
);
195 RESTArgs::get_string(s
, "access-key", access_key
, &access_key
);
196 RESTArgs::get_string(s
, "secret-key", secret_key
, &secret_key
);
197 RESTArgs::get_string(s
, "user-caps", caps
, &caps
);
198 RESTArgs::get_bool(s
, "generate-key", false, &gen_key
);
199 RESTArgs::get_bool(s
, "suspended", false, &suspended
);
200 RESTArgs::get_int32(s
, "max-buckets", RGW_DEFAULT_MAX_BUCKETS
, &max_buckets
, "a_set
);
201 RESTArgs::get_string(s
, "key-type", key_type_str
, &key_type_str
);
203 RESTArgs::get_bool(s
, "system", false, &system
);
205 if (!s
->user
->system
&& system
) {
206 ldout(s
->cct
, 0) << "cannot set system flag by non-system user" << dendl
;
211 op_state
.set_user_id(uid
);
212 op_state
.set_display_name(display_name
);
215 op_state
.set_user_email(email
);
217 op_state
.set_caps(caps
);
218 op_state
.set_access_key(access_key
);
219 op_state
.set_secret_key(secret_key
);
222 op_state
.set_max_buckets(max_buckets
);
225 op_state
.set_generate_key();
227 if (!key_type_str
.empty()) {
228 int32_t key_type
= KEY_TYPE_UNDEFINED
;
229 if (key_type_str
.compare("swift") == 0)
230 key_type
= KEY_TYPE_SWIFT
;
231 else if (key_type_str
.compare("s3") == 0)
232 key_type
= KEY_TYPE_S3
;
234 op_state
.set_key_type(key_type
);
237 if (s
->info
.args
.exists("suspended"))
238 op_state
.set_suspension(suspended
);
240 if (s
->info
.args
.exists("system"))
241 op_state
.set_system(system
);
243 http_ret
= RGWUserAdminOp_User::modify(store
, op_state
, flusher
);
246 class RGWOp_User_Remove
: public RGWRESTOp
{
249 RGWOp_User_Remove() {}
251 int check_caps(RGWUserCaps
& caps
) override
{
252 return caps
.check_cap("users", RGW_CAP_WRITE
);
255 void execute() override
;
257 const string
name() override
{ return "remove_user"; }
260 void RGWOp_User_Remove::execute()
265 RGWUserAdminOpState op_state
;
267 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
268 rgw_user
uid(uid_str
);
270 RESTArgs::get_bool(s
, "purge-data", false, &purge_data
);
272 // FIXME: no double checking
274 op_state
.set_user_id(uid
);
276 op_state
.set_purge_data(purge_data
);
278 http_ret
= RGWUserAdminOp_User::remove(store
, op_state
, flusher
);
281 class RGWOp_Subuser_Create
: public RGWRESTOp
{
284 RGWOp_Subuser_Create() {}
286 int check_caps(RGWUserCaps
& caps
) override
{
287 return caps
.check_cap("users", RGW_CAP_WRITE
);
290 void execute() override
;
292 const string
name() override
{ return "create_subuser"; }
295 void RGWOp_Subuser_Create::execute()
299 std::string secret_key
;
300 std::string access_key
;
301 std::string perm_str
;
302 std::string key_type_str
;
304 bool gen_subuser
= false; // FIXME placeholder
308 uint32_t perm_mask
= 0;
309 int32_t key_type
= KEY_TYPE_SWIFT
;
311 RGWUserAdminOpState op_state
;
313 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
314 rgw_user
uid(uid_str
);
316 RESTArgs::get_string(s
, "subuser", subuser
, &subuser
);
317 RESTArgs::get_string(s
, "access-key", access_key
, &access_key
);
318 RESTArgs::get_string(s
, "secret-key", secret_key
, &secret_key
);
319 RESTArgs::get_string(s
, "access", perm_str
, &perm_str
);
320 RESTArgs::get_string(s
, "key-type", key_type_str
, &key_type_str
);
321 //RESTArgs::get_bool(s, "generate-subuser", false, &gen_subuser);
322 RESTArgs::get_bool(s
, "generate-secret", false, &gen_secret
);
323 RESTArgs::get_bool(s
, "gen-access-key", false, &gen_access
);
325 perm_mask
= rgw_str_to_perm(perm_str
.c_str());
326 op_state
.set_perm(perm_mask
);
328 op_state
.set_user_id(uid
);
329 op_state
.set_subuser(subuser
);
330 op_state
.set_access_key(access_key
);
331 op_state
.set_secret_key(secret_key
);
332 op_state
.set_generate_subuser(gen_subuser
);
335 op_state
.set_gen_access();
338 op_state
.set_gen_secret();
340 if (!key_type_str
.empty()) {
341 if (key_type_str
.compare("swift") == 0)
342 key_type
= KEY_TYPE_SWIFT
;
343 else if (key_type_str
.compare("s3") == 0)
344 key_type
= KEY_TYPE_S3
;
346 op_state
.set_key_type(key_type
);
348 http_ret
= RGWUserAdminOp_Subuser::create(store
, op_state
, flusher
);
351 class RGWOp_Subuser_Modify
: public RGWRESTOp
{
354 RGWOp_Subuser_Modify() {}
356 int check_caps(RGWUserCaps
& caps
) override
{
357 return caps
.check_cap("users", RGW_CAP_WRITE
);
360 void execute() override
;
362 const string
name() override
{ return "modify_subuser"; }
365 void RGWOp_Subuser_Modify::execute()
369 std::string secret_key
;
370 std::string key_type_str
;
371 std::string perm_str
;
373 RGWUserAdminOpState op_state
;
376 int32_t key_type
= KEY_TYPE_SWIFT
;
380 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
381 rgw_user
uid(uid_str
);
383 RESTArgs::get_string(s
, "subuser", subuser
, &subuser
);
384 RESTArgs::get_string(s
, "secret-key", secret_key
, &secret_key
);
385 RESTArgs::get_string(s
, "access", perm_str
, &perm_str
);
386 RESTArgs::get_string(s
, "key-type", key_type_str
, &key_type_str
);
387 RESTArgs::get_bool(s
, "generate-secret", false, &gen_secret
);
389 perm_mask
= rgw_str_to_perm(perm_str
.c_str());
390 op_state
.set_perm(perm_mask
);
392 op_state
.set_user_id(uid
);
393 op_state
.set_subuser(subuser
);
395 if (!secret_key
.empty())
396 op_state
.set_secret_key(secret_key
);
399 op_state
.set_gen_secret();
401 if (!key_type_str
.empty()) {
402 if (key_type_str
.compare("swift") == 0)
403 key_type
= KEY_TYPE_SWIFT
;
404 else if (key_type_str
.compare("s3") == 0)
405 key_type
= KEY_TYPE_S3
;
407 op_state
.set_key_type(key_type
);
409 http_ret
= RGWUserAdminOp_Subuser::modify(store
, op_state
, flusher
);
412 class RGWOp_Subuser_Remove
: public RGWRESTOp
{
415 RGWOp_Subuser_Remove() {}
417 int check_caps(RGWUserCaps
& caps
) override
{
418 return caps
.check_cap("users", RGW_CAP_WRITE
);
421 void execute() override
;
423 const string
name() override
{ return "remove_subuser"; }
426 void RGWOp_Subuser_Remove::execute()
432 RGWUserAdminOpState op_state
;
434 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
435 rgw_user
uid(uid_str
);
437 RESTArgs::get_string(s
, "subuser", subuser
, &subuser
);
438 RESTArgs::get_bool(s
, "purge-keys", true, &purge_keys
);
440 op_state
.set_user_id(uid
);
441 op_state
.set_subuser(subuser
);
444 op_state
.set_purge_keys();
446 http_ret
= RGWUserAdminOp_Subuser::remove(store
, op_state
, flusher
);
449 class RGWOp_Key_Create
: public RGWRESTOp
{
452 RGWOp_Key_Create() {}
454 int check_caps(RGWUserCaps
& caps
) override
{
455 return caps
.check_cap("users", RGW_CAP_WRITE
);
458 void execute() override
;
460 const string
name() override
{ return "create_access_key"; }
463 void RGWOp_Key_Create::execute()
467 std::string access_key
;
468 std::string secret_key
;
469 std::string key_type_str
;
473 RGWUserAdminOpState op_state
;
475 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
476 rgw_user
uid(uid_str
);
478 RESTArgs::get_string(s
, "subuser", subuser
, &subuser
);
479 RESTArgs::get_string(s
, "access-key", access_key
, &access_key
);
480 RESTArgs::get_string(s
, "secret-key", secret_key
, &secret_key
);
481 RESTArgs::get_string(s
, "key-type", key_type_str
, &key_type_str
);
482 RESTArgs::get_bool(s
, "generate-key", true, &gen_key
);
484 op_state
.set_user_id(uid
);
485 op_state
.set_subuser(subuser
);
486 op_state
.set_access_key(access_key
);
487 op_state
.set_secret_key(secret_key
);
490 op_state
.set_generate_key();
492 if (!key_type_str
.empty()) {
493 int32_t key_type
= KEY_TYPE_UNDEFINED
;
494 if (key_type_str
.compare("swift") == 0)
495 key_type
= KEY_TYPE_SWIFT
;
496 else if (key_type_str
.compare("s3") == 0)
497 key_type
= KEY_TYPE_S3
;
499 op_state
.set_key_type(key_type
);
502 http_ret
= RGWUserAdminOp_Key::create(store
, op_state
, flusher
);
505 class RGWOp_Key_Remove
: public RGWRESTOp
{
508 RGWOp_Key_Remove() {}
510 int check_caps(RGWUserCaps
& caps
) override
{
511 return caps
.check_cap("users", RGW_CAP_WRITE
);
514 void execute() override
;
516 const string
name() override
{ return "remove_access_key"; }
519 void RGWOp_Key_Remove::execute()
523 std::string access_key
;
524 std::string key_type_str
;
526 RGWUserAdminOpState op_state
;
528 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
529 rgw_user
uid(uid_str
);
531 RESTArgs::get_string(s
, "subuser", subuser
, &subuser
);
532 RESTArgs::get_string(s
, "access-key", access_key
, &access_key
);
533 RESTArgs::get_string(s
, "key-type", key_type_str
, &key_type_str
);
535 op_state
.set_user_id(uid
);
536 op_state
.set_subuser(subuser
);
537 op_state
.set_access_key(access_key
);
539 if (!key_type_str
.empty()) {
540 int32_t key_type
= KEY_TYPE_UNDEFINED
;
541 if (key_type_str
.compare("swift") == 0)
542 key_type
= KEY_TYPE_SWIFT
;
543 else if (key_type_str
.compare("s3") == 0)
544 key_type
= KEY_TYPE_S3
;
546 op_state
.set_key_type(key_type
);
549 http_ret
= RGWUserAdminOp_Key::remove(store
, op_state
, flusher
);
552 class RGWOp_Caps_Add
: public RGWRESTOp
{
557 int check_caps(RGWUserCaps
& caps
) override
{
558 return caps
.check_cap("users", RGW_CAP_WRITE
);
561 void execute() override
;
563 const string
name() override
{ return "add_user_caps"; }
566 void RGWOp_Caps_Add::execute()
571 RGWUserAdminOpState op_state
;
573 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
574 rgw_user
uid(uid_str
);
576 RESTArgs::get_string(s
, "user-caps", caps
, &caps
);
578 op_state
.set_user_id(uid
);
579 op_state
.set_caps(caps
);
581 http_ret
= RGWUserAdminOp_Caps::add(store
, op_state
, flusher
);
584 class RGWOp_Caps_Remove
: public RGWRESTOp
{
587 RGWOp_Caps_Remove() {}
589 int check_caps(RGWUserCaps
& caps
) override
{
590 return caps
.check_cap("users", RGW_CAP_WRITE
);
593 void execute() override
;
595 const string
name() override
{ return "remove_user_caps"; }
598 void RGWOp_Caps_Remove::execute()
603 RGWUserAdminOpState op_state
;
605 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
606 rgw_user
uid(uid_str
);
608 RESTArgs::get_string(s
, "user-caps", caps
, &caps
);
610 op_state
.set_user_id(uid
);
611 op_state
.set_caps(caps
);
613 http_ret
= RGWUserAdminOp_Caps::remove(store
, op_state
, flusher
);
617 RGWQuotaInfo bucket_quota
;
618 RGWQuotaInfo user_quota
;
622 explicit UserQuotas(RGWUserInfo
& info
) : bucket_quota(info
.bucket_quota
),
623 user_quota(info
.user_quota
) {}
625 void dump(Formatter
*f
) const {
626 encode_json("bucket_quota", bucket_quota
, f
);
627 encode_json("user_quota", user_quota
, f
);
629 void decode_json(JSONObj
*obj
) {
630 JSONDecoder::decode_json("bucket_quota", bucket_quota
, obj
);
631 JSONDecoder::decode_json("user_quota", user_quota
, obj
);
635 class RGWOp_Quota_Info
: public RGWRESTOp
{
638 RGWOp_Quota_Info() {}
640 int check_caps(RGWUserCaps
& caps
) override
{
641 return caps
.check_cap("users", RGW_CAP_READ
);
644 void execute() override
;
646 const string
name() override
{ return "get_quota_info"; }
650 void RGWOp_Quota_Info::execute()
652 RGWUserAdminOpState op_state
;
655 std::string quota_type
;
657 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
658 RESTArgs::get_string(s
, "quota-type", quota_type
, "a_type
);
660 if (uid_str
.empty()) {
665 rgw_user
uid(uid_str
);
667 bool show_all
= quota_type
.empty();
668 bool show_bucket
= show_all
|| (quota_type
== "bucket");
669 bool show_user
= show_all
|| (quota_type
== "user");
671 if (!(show_all
|| show_bucket
|| show_user
)) {
676 op_state
.set_user_id(uid
);
679 http_ret
= user
.init(store
, op_state
);
683 if (!op_state
.has_existing_user()) {
684 http_ret
= -ERR_NO_SUCH_USER
;
690 http_ret
= user
.info(info
, &err_msg
);
696 UserQuotas
quotas(info
);
697 encode_json("quota", quotas
, s
->formatter
);
698 } else if (show_user
) {
699 encode_json("user_quota", info
.user_quota
, s
->formatter
);
701 encode_json("bucket_quota", info
.bucket_quota
, s
->formatter
);
707 class RGWOp_Quota_Set
: public RGWRESTOp
{
712 int check_caps(RGWUserCaps
& caps
) override
{
713 return caps
.check_cap("users", RGW_CAP_WRITE
);
716 void execute() override
;
718 const string
name() override
{ return "set_quota_info"; }
724 * two different ways to set the quota info: as json struct in the message body or via http params.
728 * PUT /admin/user?uid=<uid>["a-type=<type>]
730 * whereas quota-type is optional and is either user, or bucket
732 * if quota-type is not specified then we expect to get a structure that contains both quotas,
733 * otherwise we'll only get the relevant configuration.
735 * E.g., if quota type not specified:
738 * "max_size_kb" : 4096,
739 * "max_objects" : -1,
743 * "max_size_kb" : 1024,
744 * "max_objects" : -1,
750 * or if quota type is specified:
752 * "max_size_kb" : 4096,
753 * "max_objects" : -1,
757 * Another option is not to pass any body and set the following http params:
761 * max-objects=<max objects>
762 * enabled[={true,false}]
764 * all params are optionals and default to the current settings. With this type of configuration the
765 * quota-type param is mandatory.
769 void RGWOp_Quota_Set::execute()
771 RGWUserAdminOpState op_state
;
774 std::string quota_type
;
776 RESTArgs::get_string(s
, "uid", uid_str
, &uid_str
);
777 RESTArgs::get_string(s
, "quota-type", quota_type
, "a_type
);
779 if (uid_str
.empty()) {
784 rgw_user
uid(uid_str
);
786 bool set_all
= quota_type
.empty();
787 bool set_bucket
= set_all
|| (quota_type
== "bucket");
788 bool set_user
= set_all
|| (quota_type
== "user");
790 if (!(set_all
|| set_bucket
|| set_user
)) {
791 ldout(store
->ctx(), 20) << "invalid quota type" << dendl
;
796 bool use_http_params
;
798 if (s
->content_length
> 0) {
799 use_http_params
= false;
801 const char *encoding
= s
->info
.env
->get("HTTP_TRANSFER_ENCODING");
802 use_http_params
= (!encoding
|| strcmp(encoding
, "chunked") != 0);
805 if (use_http_params
&& set_all
) {
806 ldout(store
->ctx(), 20) << "quota type was not specified, can't set all quotas via http headers" << dendl
;
811 op_state
.set_user_id(uid
);
814 http_ret
= user
.init(store
, op_state
);
816 ldout(store
->ctx(), 20) << "failed initializing user info: " << http_ret
<< dendl
;
820 if (!op_state
.has_existing_user()) {
821 http_ret
= -ERR_NO_SUCH_USER
;
825 #define QUOTA_INPUT_MAX_LEN 1024
829 if ((http_ret
= rgw_rest_get_json_input(store
->ctx(), s
, quotas
, QUOTA_INPUT_MAX_LEN
, NULL
)) < 0) {
830 ldout(store
->ctx(), 20) << "failed to retrieve input" << dendl
;
834 op_state
.set_user_quota(quotas
.user_quota
);
835 op_state
.set_bucket_quota(quotas
.bucket_quota
);
839 if (!use_http_params
) {
841 http_ret
= rgw_rest_get_json_input(store
->ctx(), s
, quota
, QUOTA_INPUT_MAX_LEN
, &empty
);
843 ldout(store
->ctx(), 20) << "failed to retrieve input" << dendl
;
847 /* was probably chunked input, but no content provided, configure via http params */
848 use_http_params
= true;
852 if (use_http_params
) {
855 http_ret
= user
.info(info
, &err_msg
);
857 ldout(store
->ctx(), 20) << "failed to get user info: " << http_ret
<< dendl
;
860 RGWQuotaInfo
*old_quota
;
862 old_quota
= &info
.user_quota
;
864 old_quota
= &info
.bucket_quota
;
867 RESTArgs::get_int64(s
, "max-objects", old_quota
->max_objects
, "a
.max_objects
);
868 RESTArgs::get_int64(s
, "max-size", old_quota
->max_size
, "a
.max_size
);
870 bool has_max_size_kb
= false;
871 RESTArgs::get_int64(s
, "max-size-kb", 0, &max_size_kb
, &has_max_size_kb
);
872 if (has_max_size_kb
) {
873 quota
.max_size
= max_size_kb
* 1024;
875 RESTArgs::get_bool(s
, "enabled", old_quota
->enabled
, "a
.enabled
);
879 op_state
.set_user_quota(quota
);
881 op_state
.set_bucket_quota(quota
);
886 http_ret
= user
.modify(op_state
, &err
);
888 ldout(store
->ctx(), 20) << "failed updating user info: " << http_ret
<< ": " << err
<< dendl
;
893 RGWOp
*RGWHandler_User::op_get()
895 if (s
->info
.args
.sub_resource_exists("quota"))
896 return new RGWOp_Quota_Info
;
898 return new RGWOp_User_Info
;
901 RGWOp
*RGWHandler_User::op_put()
903 if (s
->info
.args
.sub_resource_exists("subuser"))
904 return new RGWOp_Subuser_Create
;
906 if (s
->info
.args
.sub_resource_exists("key"))
907 return new RGWOp_Key_Create
;
909 if (s
->info
.args
.sub_resource_exists("caps"))
910 return new RGWOp_Caps_Add
;
912 if (s
->info
.args
.sub_resource_exists("quota"))
913 return new RGWOp_Quota_Set
;
915 return new RGWOp_User_Create
;
918 RGWOp
*RGWHandler_User::op_post()
920 if (s
->info
.args
.sub_resource_exists("subuser"))
921 return new RGWOp_Subuser_Modify
;
923 return new RGWOp_User_Modify
;
926 RGWOp
*RGWHandler_User::op_delete()
928 if (s
->info
.args
.sub_resource_exists("subuser"))
929 return new RGWOp_Subuser_Remove
;
931 if (s
->info
.args
.sub_resource_exists("key"))
932 return new RGWOp_Key_Remove
;
934 if (s
->info
.args
.sub_resource_exists("caps"))
935 return new RGWOp_Caps_Remove
;
937 return new RGWOp_User_Remove
;