1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
4 #ifndef CEPH_RGW_USER_H
5 #define CEPH_RGW_USER_H
8 #include <boost/algorithm/string.hpp>
9 #include "include/ceph_assert.h"
11 #include "include/types.h"
12 #include "rgw_common.h"
13 #include "rgw_tools.h"
15 #include "rgw_string.h"
17 #include "common/Formatter.h"
18 #include "rgw_formats.h"
19 #include "rgw_metadata.h"
21 #define RGW_USER_ANON_ID "anonymous"
23 #define SECRET_KEY_LEN 40
24 #define PUBLIC_ID_LEN 20
25 #define RAND_SUBUSER_LEN 5
27 #define XMLNS_AWS_S3 "http://s3.amazonaws.com/doc/2006-03-01/"
33 class RGWGetUserStats_CB
;
34 namespace rgw
{ namespace sal
{
39 * A string wrapper that includes encode/decode functions
40 * for easily accessing a UID in all forms
45 void encode(bufferlist
& bl
) const {
51 void decode(bufferlist::const_iterator
& bl
) {
58 WRITE_CLASS_ENCODER(RGWUID
)
60 extern int rgw_user_sync_all_stats(rgw::sal::RGWRadosStore
*store
, const rgw_user
& user_id
, optional_yield y
);
61 extern int rgw_user_get_all_buckets_stats(
62 rgw::sal::RGWRadosStore
*store
,const rgw_user
& user_id
,
63 map
<string
, cls_user_bucket_entry
>& buckets_usage_map
, optional_yield y
);
66 * Get the anonymous (ie, unauthenticated) user info.
68 extern void rgw_get_anon_user(RGWUserInfo
& info
);
71 * Save the given user information to storage.
72 * Returns: 0 on success, -ERR# on failure.
74 extern int rgw_store_user_info(RGWUserCtl
*user_ctl
,
76 RGWUserInfo
*old_info
,
77 RGWObjVersionTracker
*objv_tracker
,
81 map
<string
, bufferlist
> *pattrs
= nullptr);
84 * Given an user_id, finds the user info associated with it.
85 * returns: 0 on success, -ERR# on failure (including nonexistence)
87 extern int rgw_get_user_info_by_uid(RGWUserCtl
*user_ctl
,
88 const rgw_user
& user_id
,
91 RGWObjVersionTracker
*objv_tracker
= nullptr,
92 real_time
*pmtime
= nullptr,
93 rgw_cache_entry_info
*cache_info
= nullptr,
94 map
<string
, bufferlist
> *pattrs
= nullptr);
96 * Given an email, finds the user info associated with it.
97 * returns: 0 on success, -ERR# on failure (including nonexistence)
99 extern int rgw_get_user_info_by_email(RGWUserCtl
*user_ctl
,
100 string
& email
, RGWUserInfo
& info
,
102 RGWObjVersionTracker
*objv_tracker
= NULL
,
103 real_time
*pmtime
= nullptr);
105 * Given an swift username, finds the user info associated with it.
106 * returns: 0 on success, -ERR# on failure (including nonexistence)
108 extern int rgw_get_user_info_by_swift(RGWUserCtl
*user_ctl
,
109 const string
& swift_name
,
110 RGWUserInfo
& info
, /* out */
112 RGWObjVersionTracker
*objv_tracker
= nullptr,
113 real_time
*pmtime
= nullptr);
115 * Given an access key, finds the user info associated with it.
116 * returns: 0 on success, -ERR# on failure (including nonexistence)
118 extern int rgw_get_user_info_by_access_key(RGWUserCtl
*user_ctl
,
119 const std::string
& access_key
,
122 RGWObjVersionTracker
* objv_tracker
= nullptr,
123 real_time
* pmtime
= nullptr);
125 extern void rgw_perm_to_str(uint32_t mask
, char *buf
, int len
);
126 extern uint32_t rgw_str_to_perm(const char *str
);
128 extern int rgw_validate_tenant_name(const string
& t
);
149 * An RGWUser class along with supporting classes created
150 * to support the creation of an RESTful administrative API
152 struct RGWUserAdminOpState
{
156 std::string user_email
;
157 std::string display_name
;
158 rgw_user new_user_id
;
159 bool overwrite_new_user
= false;
168 RGWObjVersionTracker objv
;
170 map
<int, string
> temp_url_keys
;
172 // subuser attributes
177 std::string id
; // access key
178 std::string key
; // secret key
181 std::set
<string
> mfa_ids
;
183 // operation attributes
186 bool existing_subuser
;
188 bool subuser_specified
;
195 bool key_type_setbycontext
; // key type set by user or subuser context
198 bool display_name_specified
;
199 bool user_email_specified
;
200 bool max_buckets_specified
;
202 bool op_mask_specified
;
205 bool admin_specified
= false;
206 bool system_specified
;
208 bool temp_url_key_specified
;
212 bool mfa_ids_specified
;
217 bool key_params_checked
;
218 bool subuser_params_checked
;
219 bool user_params_checked
;
221 bool bucket_quota_specified
;
222 bool user_quota_specified
;
224 RGWQuotaInfo bucket_quota
;
225 RGWQuotaInfo user_quota
;
227 // req parameters for listing user
229 uint32_t max_entries
;
230 rgw_placement_rule default_placement
; // user default placement
231 bool default_placement_specified
;
233 list
<string
> placement_tags
; // user default placement_tags
234 bool placement_tags_specified
;
236 void set_access_key(const std::string
& access_key
) {
237 if (access_key
.empty())
246 void set_secret_key(const std::string
& secret_key
) {
247 if (secret_key
.empty())
251 key_specified
= true;
256 void set_user_id(rgw_user
& id
) {
263 void set_new_user_id(rgw_user
& id
) {
269 void set_overwrite_new_user(bool b
) {
270 overwrite_new_user
= b
;
273 void set_user_email(std::string
& email
) {
274 /* always lowercase email address */
275 boost::algorithm::to_lower(email
);
277 user_email_specified
= true;
280 void set_display_name(const std::string
& name
) {
285 display_name_specified
= true;
288 void set_subuser(std::string
& _subuser
) {
289 if (_subuser
.empty())
292 size_t pos
= _subuser
.find(":");
293 if (pos
!= string::npos
) {
295 tmp_id
.from_str(_subuser
.substr(0, pos
));
296 if (tmp_id
.tenant
.empty()) {
297 user_id
.id
= tmp_id
.id
;
301 subuser
= _subuser
.substr(pos
+1);
306 subuser_specified
= true;
309 void set_caps(const std::string
& _caps
) {
314 caps_specified
= true;
317 void set_perm(uint32_t perm
) {
319 perm_specified
= true;
322 void set_op_mask(uint32_t mask
) {
324 op_mask_specified
= true;
327 void set_temp_url_key(const string
& key
, int index
) {
328 temp_url_keys
[index
] = key
;
329 temp_url_key_specified
= true;
332 void set_key_type(int32_t type
) {
334 type_specified
= true;
337 void set_suspension(__u8 is_suspended
) {
338 suspended
= is_suspended
;
339 suspension_op
= true;
342 void set_admin(__u8 is_admin
) {
344 admin_specified
= true;
347 void set_system(__u8 is_system
) {
349 system_specified
= true;
352 void set_exclusive(__u8 is_exclusive
) {
353 exclusive
= is_exclusive
;
356 void set_fetch_stats(__u8 is_fetch_stats
) {
357 fetch_stats
= is_fetch_stats
;
360 void set_sync_stats(__u8 is_sync_stats
) {
361 sync_stats
= is_sync_stats
;
364 void set_user_info(RGWUserInfo
& user_info
) {
365 user_id
= user_info
.user_id
;
369 void set_max_buckets(int32_t mb
) {
371 max_buckets_specified
= true;
374 void set_gen_access() {
379 void set_gen_secret() {
384 void set_generate_key() {
392 void clear_generate_key() {
397 void set_purge_keys() {
402 void set_bucket_quota(RGWQuotaInfo
& quota
) {
403 bucket_quota
= quota
;
404 bucket_quota_specified
= true;
407 void set_user_quota(RGWQuotaInfo
& quota
) {
409 user_quota_specified
= true;
412 void set_mfa_ids(const std::set
<string
>& ids
) {
414 mfa_ids_specified
= true;
417 void set_default_placement(const rgw_placement_rule
& _placement
) {
418 default_placement
= _placement
;
419 default_placement_specified
= true;
422 void set_placement_tags(const list
<string
>& _tags
) {
423 placement_tags
= _tags
;
424 placement_tags_specified
= true;
427 bool is_populated() { return populated
; }
428 bool is_initialized() { return initialized
; }
429 bool has_existing_user() { return existing_user
; }
430 bool has_existing_key() { return existing_key
; }
431 bool has_existing_subuser() { return existing_subuser
; }
432 bool has_existing_email() { return existing_email
; }
433 bool has_subuser() { return subuser_specified
; }
434 bool has_key_op() { return key_op
; }
435 bool has_caps_op() { return caps_specified
; }
436 bool has_suspension_op() { return suspension_op
; }
437 bool has_subuser_perm() { return perm_specified
; }
438 bool has_op_mask() { return op_mask_specified
; }
439 bool will_gen_access() { return gen_access
; }
440 bool will_gen_secret() { return gen_secret
; }
441 bool will_gen_subuser() { return gen_subuser
; }
442 bool will_purge_keys() { return purge_keys
; }
443 bool will_purge_data() { return purge_data
; }
444 bool will_generate_subuser() { return gen_subuser
; }
445 bool has_bucket_quota() { return bucket_quota_specified
; }
446 bool has_user_quota() { return user_quota_specified
; }
447 void set_populated() { populated
= true; }
448 void clear_populated() { populated
= false; }
449 void set_initialized() { initialized
= true; }
450 void set_existing_user(bool flag
) { existing_user
= flag
; }
451 void set_existing_key(bool flag
) { existing_key
= flag
; }
452 void set_existing_subuser(bool flag
) { existing_subuser
= flag
; }
453 void set_existing_email(bool flag
) { existing_email
= flag
; }
454 void set_purge_data(bool flag
) { purge_data
= flag
; }
455 void set_generate_subuser(bool flag
) { gen_subuser
= flag
; }
456 __u8
get_suspension_status() { return suspended
; }
457 int32_t get_key_type() {return key_type
; }
458 uint32_t get_subuser_perm() { return perm_mask
; }
459 int32_t get_max_buckets() { return max_buckets
; }
460 uint32_t get_op_mask() { return op_mask
; }
461 RGWQuotaInfo
& get_bucket_quota() { return bucket_quota
; }
462 RGWQuotaInfo
& get_user_quota() { return user_quota
; }
463 set
<string
>& get_mfa_ids() { return mfa_ids
; }
465 rgw_user
& get_user_id() { return user_id
; }
466 std::string
get_subuser() { return subuser
; }
467 std::string
get_access_key() { return id
; }
468 std::string
get_secret_key() { return key
; }
469 std::string
get_caps() { return caps
; }
470 std::string
get_user_email() { return user_email
; }
471 std::string
get_display_name() { return display_name
; }
472 rgw_user
& get_new_uid() { return new_user_id
; }
473 bool get_overwrite_new_user() const { return overwrite_new_user
; }
474 map
<int, std::string
>& get_temp_url_keys() { return temp_url_keys
; }
476 RGWUserInfo
& get_user_info() { return info
; }
478 map
<std::string
, RGWAccessKey
> *get_swift_keys() { return &info
.swift_keys
; }
479 map
<std::string
, RGWAccessKey
> *get_access_keys() { return &info
.access_keys
; }
480 map
<std::string
, RGWSubUser
> *get_subusers() { return &info
.subusers
; }
482 RGWUserCaps
*get_caps_obj() { return &info
.caps
; }
484 std::string
build_default_swift_kid() {
485 if (user_id
.empty() || subuser
.empty())
496 std::string
generate_subuser() {
500 std::string generated_subuser
;
501 user_id
.to_str(generated_subuser
);
502 std::string rand_suffix
;
504 int sub_buf_size
= RAND_SUBUSER_LEN
+ 1;
505 char sub_buf
[RAND_SUBUSER_LEN
+ 1];
507 gen_rand_alphanumeric_upper(g_ceph_context
, sub_buf
, sub_buf_size
);
509 rand_suffix
= sub_buf
;
510 if (rand_suffix
.empty())
513 generated_subuser
.append(rand_suffix
);
514 subuser
= generated_subuser
;
516 return generated_subuser
;
519 RGWUserAdminOpState() : user_id(RGW_USER_ANON_ID
)
521 max_buckets
= RGW_DEFAULT_MAX_BUCKETS
;
523 perm_mask
= RGW_PERM_NONE
;
531 existing_user
= false;
532 existing_key
= false;
533 existing_subuser
= false;
534 existing_email
= false;
535 subuser_specified
= false;
536 caps_specified
= false;
541 id_specified
= false;
542 key_specified
= false;
543 type_specified
= false;
544 key_type_setbycontext
= false;
546 display_name_specified
= false;
547 user_email_specified
= false;
548 max_buckets_specified
= false;
549 perm_specified
= false;
550 op_mask_specified
= false;
551 suspension_op
= false;
552 system_specified
= false;
556 key_params_checked
= false;
557 subuser_params_checked
= false;
558 user_params_checked
= false;
559 bucket_quota_specified
= false;
560 temp_url_key_specified
= false;
561 user_quota_specified
= false;
562 found_by_uid
= false;
563 found_by_email
= false;
564 found_by_key
= false;
565 mfa_ids_specified
= false;
566 default_placement_specified
= false;
567 placement_tags_specified
= false;
575 class RGWAccessKeyPool
577 RGWUser
*user
{nullptr};
579 std::map
<std::string
, int, ltstr_nocase
> key_type_map
;
581 rgw::sal::RGWRadosStore
*store
{nullptr};
582 RGWUserCtl
*user_ctl
{nullptr};
584 map
<std::string
, RGWAccessKey
> *swift_keys
{nullptr};
585 map
<std::string
, RGWAccessKey
> *access_keys
{nullptr};
587 // we don't want to allow keys for the anonymous user or a null user
588 bool keys_allowed
{false};
591 int create_key(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
592 int generate_key(RGWUserAdminOpState
& op_state
, optional_yield y
,
593 std::string
*err_msg
= NULL
);
594 int modify_key(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
596 int check_key_owner(RGWUserAdminOpState
& op_state
);
597 bool check_existing_key(RGWUserAdminOpState
& op_state
);
598 int check_op(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
600 /* API Contract Fulfilment */
601 int execute_add(RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
602 bool defer_save
, optional_yield y
);
603 int execute_remove(RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
604 bool defer_save
, optional_yield y
);
605 int remove_subuser_keys(RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
606 bool defer_save
, optional_yield y
);
608 int add(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
610 int remove(RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
611 bool defer_save
, optional_yield y
);
613 explicit RGWAccessKeyPool(RGWUser
* usr
);
615 int init(RGWUserAdminOpState
& op_state
);
617 /* API Contracted Methods */
618 int add(RGWUserAdminOpState
& op_state
, optional_yield y
,
619 std::string
*err_msg
= NULL
);
620 int remove(RGWUserAdminOpState
& op_state
, optional_yield y
,
621 std::string
*err_msg
= NULL
);
623 friend class RGWUser
;
624 friend class RGWSubUserPool
;
629 RGWUser
*user
{nullptr};
632 rgw::sal::RGWRadosStore
*store
{nullptr};
633 RGWUserCtl
*user_ctl
{nullptr};
634 bool subusers_allowed
{false};
636 map
<string
, RGWSubUser
> *subuser_map
{nullptr};
639 int check_op(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
641 /* API Contract Fulfillment */
642 int execute_add(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
643 int execute_remove(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
644 int execute_modify(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
646 int add(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
648 int remove(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
649 int modify(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
, bool defer_save
);
651 explicit RGWSubUserPool(RGWUser
*user
);
653 bool exists(std::string subuser
);
654 int init(RGWUserAdminOpState
& op_state
);
656 /* API contracted methods */
657 int add(RGWUserAdminOpState
& op_state
, optional_yield y
,
658 std::string
*err_msg
= NULL
);
659 int remove(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
660 int modify(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
662 friend class RGWUser
;
667 RGWUserCaps
*caps
{nullptr};
668 bool caps_allowed
{false};
669 RGWUser
*user
{nullptr};
672 int add(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
674 int remove(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
678 explicit RGWUserCapPool(RGWUser
*user
);
680 int init(RGWUserAdminOpState
& op_state
);
682 /* API contracted methods */
683 int add(RGWUserAdminOpState
& op_state
, optional_yield y
,
684 std::string
*err_msg
= NULL
);
685 int remove(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
687 friend class RGWUser
;
694 RGWUserInfo old_info
;
695 rgw::sal::RGWRadosStore
*store
{nullptr};
696 RGWUserCtl
*user_ctl
{nullptr};
699 bool info_stored
{false};
701 void set_populated() { info_stored
= true; }
702 void clear_populated() { info_stored
= false; }
703 bool is_populated() { return info_stored
; }
705 int check_op(RGWUserAdminOpState
& req
, std::string
*err_msg
);
706 int update(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, optional_yield y
);
708 void clear_members();
711 /* API Contract Fulfillment */
712 int execute_add(RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
714 int execute_remove(RGWUserAdminOpState
& op_state
,
715 std::string
*err_msg
, optional_yield y
);
716 int execute_modify(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, optional_yield y
);
717 int execute_rename(RGWUserAdminOpState
& op_state
, std::string
*err_msg
, optional_yield y
);
722 int init(rgw::sal::RGWRadosStore
*storage
, RGWUserAdminOpState
& op_state
,
725 int init_storage(rgw::sal::RGWRadosStore
*storage
);
726 int init(RGWUserAdminOpState
& op_state
, optional_yield y
);
727 int init_members(RGWUserAdminOpState
& op_state
);
729 rgw::sal::RGWRadosStore
*get_store() { return store
; }
730 RGWUserCtl
*get_user_ctl() { return user_ctl
; }
732 /* API Contracted Members */
734 RGWAccessKeyPool keys
;
735 RGWSubUserPool subusers
;
737 /* API Contracted Methods */
738 int add(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
740 int remove(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
742 int rename(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
744 /* remove an already populated RGWUser */
745 int remove(std::string
*err_msg
= NULL
);
747 int modify(RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
749 /* retrieve info from an existing user in the RGW system */
750 int info(RGWUserAdminOpState
& op_state
, RGWUserInfo
& fetched_info
, optional_yield y
,
751 std::string
*err_msg
= NULL
);
753 /* info from an already populated RGWUser */
754 int info (RGWUserInfo
& fetched_info
, std::string
*err_msg
= NULL
);
756 /* list the existing users */
757 int list(RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
);
759 friend class RGWAccessKeyPool
;
760 friend class RGWSubUserPool
;
761 friend class RGWUserCapPool
;
764 /* Wrappers for admin API functionality */
766 class RGWUserAdminOp_User
769 static int list(rgw::sal::RGWRadosStore
*store
,
770 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
);
772 static int info(rgw::sal::RGWRadosStore
*store
,
773 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
776 static int create(rgw::sal::RGWRadosStore
*store
,
777 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
780 static int modify(rgw::sal::RGWRadosStore
*store
,
781 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
, optional_yield y
);
783 static int remove(rgw::sal::RGWRadosStore
*store
,
784 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
, optional_yield y
);
787 class RGWUserAdminOp_Subuser
790 static int create(rgw::sal::RGWRadosStore
*store
,
791 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
794 static int modify(rgw::sal::RGWRadosStore
*store
,
795 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
798 static int remove(rgw::sal::RGWRadosStore
*store
,
799 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
803 class RGWUserAdminOp_Key
806 static int create(rgw::sal::RGWRadosStore
*store
,
807 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
810 static int remove(rgw::sal::RGWRadosStore
*store
,
811 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
815 class RGWUserAdminOp_Caps
818 static int add(rgw::sal::RGWRadosStore
*store
,
819 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
822 static int remove(rgw::sal::RGWRadosStore
*store
,
823 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
827 struct RGWUserCompleteInfo
{
829 map
<string
, bufferlist
> attrs
;
830 bool has_attrs
{false};
832 void dump(Formatter
* const f
) const {
834 encode_json("attrs", attrs
, f
);
837 void decode_json(JSONObj
*obj
) {
838 decode_json_obj(info
, obj
);
839 has_attrs
= JSONDecoder::decode_json("attrs", attrs
, obj
);
843 class RGWUserMetadataObject
: public RGWMetadataObject
{
844 RGWUserCompleteInfo uci
;
846 RGWUserMetadataObject() {}
847 RGWUserMetadataObject(const RGWUserCompleteInfo
& _uci
, const obj_version
& v
, real_time m
)
853 void dump(Formatter
*f
) const override
{
857 RGWUserCompleteInfo
& get_uci() {
862 class RGWUserMetadataHandler
;
867 RGWSI_Zone
*zone
{nullptr};
868 RGWSI_User
*user
{nullptr};
872 RGWBucketCtl
*bucket
{nullptr};
875 RGWUserMetadataHandler
*umhandler
;
876 RGWSI_MetaBackend_Handler
*be_handler
{nullptr};
879 RGWUserCtl(RGWSI_Zone
*zone_svc
,
880 RGWSI_User
*user_svc
,
881 RGWUserMetadataHandler
*_umhandler
);
883 void init(RGWBucketCtl
*bucket_ctl
) {
884 ctl
.bucket
= bucket_ctl
;
887 RGWBucketCtl
*get_bucket_ctl() {
892 RGWObjVersionTracker
*objv_tracker
{nullptr};
893 ceph::real_time
*mtime
{nullptr};
894 rgw_cache_entry_info
*cache_info
{nullptr};
895 map
<string
, bufferlist
> *attrs
{nullptr};
899 GetParams
& set_objv_tracker(RGWObjVersionTracker
*_objv_tracker
) {
900 objv_tracker
= _objv_tracker
;
904 GetParams
& set_mtime(ceph::real_time
*_mtime
) {
909 GetParams
& set_cache_info(rgw_cache_entry_info
*_cache_info
) {
910 cache_info
= _cache_info
;
914 GetParams
& set_attrs(map
<string
, bufferlist
> *_attrs
) {
921 RGWUserInfo
*old_info
{nullptr};
922 RGWObjVersionTracker
*objv_tracker
{nullptr};
923 ceph::real_time mtime
;
924 bool exclusive
{false};
925 map
<string
, bufferlist
> *attrs
{nullptr};
929 PutParams
& set_old_info(RGWUserInfo
*_info
) {
934 PutParams
& set_objv_tracker(RGWObjVersionTracker
*_objv_tracker
) {
935 objv_tracker
= _objv_tracker
;
939 PutParams
& set_mtime(const ceph::real_time
& _mtime
) {
944 PutParams
& set_exclusive(bool _exclusive
) {
945 exclusive
= _exclusive
;
949 PutParams
& set_attrs(map
<string
, bufferlist
> *_attrs
) {
955 struct RemoveParams
{
956 RGWObjVersionTracker
*objv_tracker
{nullptr};
960 RemoveParams
& set_objv_tracker(RGWObjVersionTracker
*_objv_tracker
) {
961 objv_tracker
= _objv_tracker
;
966 int get_info_by_uid(const rgw_user
& uid
, RGWUserInfo
*info
,
967 optional_yield y
, const GetParams
& params
= {});
968 int get_info_by_email(const string
& email
, RGWUserInfo
*info
,
969 optional_yield y
, const GetParams
& params
= {});
970 int get_info_by_swift(const string
& swift_name
, RGWUserInfo
*info
,
971 optional_yield y
, const GetParams
& params
= {});
972 int get_info_by_access_key(const string
& access_key
, RGWUserInfo
*info
,
973 optional_yield y
, const GetParams
& params
= {});
975 int get_attrs_by_uid(const rgw_user
& user_id
,
976 map
<string
, bufferlist
> *attrs
,
978 RGWObjVersionTracker
*objv_tracker
= nullptr);
980 int store_info(const RGWUserInfo
& info
, optional_yield y
,
981 const PutParams
& params
= {});
982 int remove_info(const RGWUserInfo
& info
, optional_yield y
,
983 const RemoveParams
& params
= {});
985 int add_bucket(const rgw_user
& user
,
986 const rgw_bucket
& bucket
,
987 ceph::real_time creation_time
,
989 int remove_bucket(const rgw_user
& user
,
990 const rgw_bucket
& bucket
, optional_yield y
);
991 int list_buckets(const rgw_user
& user
,
992 const string
& marker
,
993 const string
& end_marker
,
996 RGWUserBuckets
*buckets
,
999 uint64_t default_max
= 1000);
1001 int flush_bucket_stats(const rgw_user
& user
,
1002 const RGWBucketEnt
& ent
,
1004 int complete_flush_stats(const rgw_user
& user
, optional_yield y
);
1005 int reset_stats(const rgw_user
& user
, optional_yield y
);
1006 int read_stats(const rgw_user
& user
, RGWStorageStats
*stats
,
1008 ceph::real_time
*last_stats_sync
= nullptr, /* last time a full stats sync completed */
1009 ceph::real_time
*last_stats_update
= nullptr); /* last time a stats update was done */
1010 int read_stats_async(const rgw_user
& user
, RGWGetUserStats_CB
*ctx
);
1013 class RGWUserMetaHandlerAllocator
{
1015 static RGWMetadataHandler
*alloc(RGWSI_User
*user_svc
);