1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
7 #include <boost/algorithm/string.hpp>
8 #include "include/ceph_assert.h"
10 #include "include/types.h"
11 #include "rgw_common.h"
12 #include "rgw_tools.h"
14 #include "rgw_string.h"
16 #include "common/Formatter.h"
17 #include "rgw_formats.h"
18 #include "rgw_metadata.h"
19 #include "rgw_sal_fwd.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
;
36 * A string wrapper that includes encode/decode functions
37 * for easily accessing a UID in all forms
42 void encode(bufferlist
& bl
) const {
48 void decode(bufferlist::const_iterator
& bl
) {
55 WRITE_CLASS_ENCODER(RGWUID
)
57 /** Entry for bucket metadata collection */
58 struct bucket_meta_entry
{
61 ceph::real_time creation_time
;
65 extern int rgw_user_sync_all_stats(const DoutPrefixProvider
*dpp
, rgw::sal::Driver
* driver
, rgw::sal::User
* user
, optional_yield y
);
66 extern int rgw_user_get_all_buckets_stats(const DoutPrefixProvider
*dpp
,
67 rgw::sal::Driver
* driver
, rgw::sal::User
* user
,
68 std::map
<std::string
, bucket_meta_entry
>& buckets_usage_map
, optional_yield y
);
71 * Get the anonymous (ie, unauthenticated) user info.
73 extern void rgw_get_anon_user(RGWUserInfo
& info
);
75 extern void rgw_perm_to_str(uint32_t mask
, char *buf
, int len
);
76 extern uint32_t rgw_str_to_perm(const char *str
);
78 extern int rgw_validate_tenant_name(const std::string
& t
);
99 * An RGWUser class along with supporting classes created
100 * to support the creation of an RESTful administrative API
102 struct RGWUserAdminOpState
{
104 std::unique_ptr
<rgw::sal::User
> user
;
105 std::string user_email
;
106 std::string display_name
;
107 rgw_user new_user_id
;
108 bool overwrite_new_user
= false;
109 int32_t max_buckets
{RGW_DEFAULT_MAX_BUCKETS
};
117 RGWObjVersionTracker objv
;
119 std::map
<int, std::string
> temp_url_keys
;
121 // subuser attributes
123 uint32_t perm_mask
{RGW_PERM_NONE
};
126 std::string id
; // access key
127 std::string key
; // secret key
128 // access keys fetched for a user in the middle of an op
129 std::map
<std::string
, RGWAccessKey
> op_access_keys
;
130 int32_t key_type
{-1};
131 bool access_key_exist
= false;
133 std::set
<std::string
> mfa_ids
;
135 // operation attributes
136 bool existing_user
{false};
137 bool existing_key
{false};
138 bool existing_subuser
{false};
139 bool existing_email
{false};
140 bool subuser_specified
{false};
141 bool gen_secret
{false};
142 bool gen_access
{false};
143 bool gen_subuser
{false};
144 bool id_specified
{false};
145 bool key_specified
{false};
146 bool type_specified
{false};
147 bool key_type_setbycontext
{false}; // key type set by user or subuser context
148 bool purge_data
{false};
149 bool purge_keys
{false};
150 bool display_name_specified
{false};
151 bool user_email_specified
{false};
152 bool max_buckets_specified
{false};
153 bool perm_specified
{false};
154 bool op_mask_specified
{false};
155 bool caps_specified
{false};
156 bool suspension_op
{false};
157 bool admin_specified
{false};
158 bool system_specified
{false};
160 bool temp_url_key_specified
{false};
161 bool found_by_uid
{false};
162 bool found_by_email
{false};
163 bool found_by_key
{false};
164 bool mfa_ids_specified
{false};
167 bool populated
{false};
168 bool initialized
{false};
169 bool key_params_checked
{false};
170 bool subuser_params_checked
{false};
171 bool user_params_checked
{false};
173 bool bucket_quota_specified
{false};
174 bool user_quota_specified
{false};
175 bool bucket_ratelimit_specified
{false};
176 bool user_ratelimit_specified
{false};
179 RGWRateLimitInfo user_ratelimit
;
180 RGWRateLimitInfo bucket_ratelimit
;
182 // req parameters for listing user
183 std::string marker
{""};
184 uint32_t max_entries
{1000};
185 rgw_placement_rule default_placement
; // user default placement
186 bool default_placement_specified
{false};
188 std::list
<std::string
> placement_tags
; // user default placement_tags
189 bool placement_tags_specified
{false};
191 void set_access_key(const std::string
& access_key
) {
192 if (access_key
.empty())
201 void set_secret_key(const std::string
& secret_key
) {
202 if (secret_key
.empty())
206 key_specified
= true;
211 void set_user_id(const rgw_user
& id
);
213 void set_new_user_id(const rgw_user
& id
) {
219 void set_overwrite_new_user(bool b
) {
220 overwrite_new_user
= b
;
223 void set_user_email(std::string
& email
) {
224 /* always lowercase email address */
225 boost::algorithm::to_lower(email
);
227 user_email_specified
= true;
230 void set_display_name(const std::string
& name
) {
235 display_name_specified
= true;
238 void set_subuser(std::string
& _subuser
);
240 void set_caps(const std::string
& _caps
) {
245 caps_specified
= true;
248 void set_perm(uint32_t perm
) {
250 perm_specified
= true;
253 void set_op_mask(uint32_t mask
) {
255 op_mask_specified
= true;
258 void set_temp_url_key(const std::string
& key
, int index
) {
259 temp_url_keys
[index
] = key
;
260 temp_url_key_specified
= true;
263 void set_key_type(int32_t type
) {
265 type_specified
= true;
268 void set_access_key_exist() {
269 access_key_exist
= true;
272 void set_suspension(__u8 is_suspended
) {
273 suspended
= is_suspended
;
274 suspension_op
= true;
277 void set_admin(__u8 is_admin
) {
279 admin_specified
= true;
282 void set_system(__u8 is_system
) {
284 system_specified
= true;
287 void set_exclusive(__u8 is_exclusive
) {
288 exclusive
= is_exclusive
;
291 void set_fetch_stats(__u8 is_fetch_stats
) {
292 fetch_stats
= is_fetch_stats
;
295 void set_sync_stats(__u8 is_sync_stats
) {
296 sync_stats
= is_sync_stats
;
299 void set_user_info(RGWUserInfo
& user_info
);
301 void set_user_version_tracker(RGWObjVersionTracker
& objv_tracker
);
303 void set_max_buckets(int32_t mb
) {
305 max_buckets_specified
= true;
308 void set_gen_access() {
313 void set_gen_secret() {
318 void set_generate_key() {
326 void clear_generate_key() {
331 void set_purge_keys() {
336 void set_bucket_quota(RGWQuotaInfo
& quotas
) {
337 quota
.bucket_quota
= quotas
;
338 bucket_quota_specified
= true;
341 void set_user_quota(RGWQuotaInfo
& quotas
) {
342 quota
.user_quota
= quotas
;
343 user_quota_specified
= true;
346 void set_bucket_ratelimit(RGWRateLimitInfo
& ratelimit
) {
347 bucket_ratelimit
= ratelimit
;
348 bucket_ratelimit_specified
= true;
351 void set_user_ratelimit(RGWRateLimitInfo
& ratelimit
) {
352 user_ratelimit
= ratelimit
;
353 user_ratelimit_specified
= true;
356 void set_mfa_ids(const std::set
<std::string
>& ids
) {
358 mfa_ids_specified
= true;
361 void set_default_placement(const rgw_placement_rule
& _placement
) {
362 default_placement
= _placement
;
363 default_placement_specified
= true;
366 void set_placement_tags(const std::list
<std::string
>& _tags
) {
367 placement_tags
= _tags
;
368 placement_tags_specified
= true;
371 bool is_populated() { return populated
; }
372 bool is_initialized() { return initialized
; }
373 bool has_existing_user() { return existing_user
; }
374 bool has_existing_key() { return existing_key
; }
375 bool has_existing_subuser() { return existing_subuser
; }
376 bool has_existing_email() { return existing_email
; }
377 bool has_subuser() { return subuser_specified
; }
378 bool has_key_op() { return key_op
; }
379 bool has_caps_op() { return caps_specified
; }
380 bool has_suspension_op() { return suspension_op
; }
381 bool has_subuser_perm() { return perm_specified
; }
382 bool has_op_mask() { return op_mask_specified
; }
383 bool will_gen_access() { return gen_access
; }
384 bool will_gen_secret() { return gen_secret
; }
385 bool will_gen_subuser() { return gen_subuser
; }
386 bool will_purge_keys() { return purge_keys
; }
387 bool will_purge_data() { return purge_data
; }
388 bool will_generate_subuser() { return gen_subuser
; }
389 bool has_bucket_quota() { return bucket_quota_specified
; }
390 bool has_user_quota() { return user_quota_specified
; }
391 void set_populated() { populated
= true; }
392 void clear_populated() { populated
= false; }
393 void set_initialized() { initialized
= true; }
394 void set_existing_user(bool flag
) { existing_user
= flag
; }
395 void set_existing_key(bool flag
) { existing_key
= flag
; }
396 void set_existing_subuser(bool flag
) { existing_subuser
= flag
; }
397 void set_existing_email(bool flag
) { existing_email
= flag
; }
398 void set_purge_data(bool flag
) { purge_data
= flag
; }
399 void set_generate_subuser(bool flag
) { gen_subuser
= flag
; }
400 __u8
get_suspension_status() { return suspended
; }
401 int32_t get_key_type() {return key_type
; }
402 bool get_access_key_exist() {return access_key_exist
; }
403 uint32_t get_subuser_perm() { return perm_mask
; }
404 int32_t get_max_buckets() { return max_buckets
; }
405 uint32_t get_op_mask() { return op_mask
; }
406 RGWQuotaInfo
& get_bucket_quota() { return quota
.bucket_quota
; }
407 RGWQuotaInfo
& get_user_quota() { return quota
.user_quota
; }
408 std::set
<std::string
>& get_mfa_ids() { return mfa_ids
; }
410 rgw::sal::User
* get_user() { return user
.get(); }
411 const rgw_user
& get_user_id();
412 std::string
get_subuser() { return subuser
; }
413 std::string
get_access_key() { return id
; }
414 std::string
get_secret_key() { return key
; }
415 std::string
get_caps() { return caps
; }
416 std::string
get_user_email() { return user_email
; }
417 std::string
get_display_name() { return display_name
; }
418 rgw_user
& get_new_uid() { return new_user_id
; }
419 bool get_overwrite_new_user() const { return overwrite_new_user
; }
420 std::map
<int, std::string
>& get_temp_url_keys() { return temp_url_keys
; }
422 RGWUserInfo
& get_user_info();
424 std::map
<std::string
, RGWAccessKey
>* get_swift_keys();
425 std::map
<std::string
, RGWAccessKey
>* get_access_keys();
426 std::map
<std::string
, RGWSubUser
>* get_subusers();
428 RGWUserCaps
* get_caps_obj();
430 std::string
build_default_swift_kid();
432 std::string
generate_subuser();
434 RGWUserAdminOpState(rgw::sal::Driver
* driver
);
439 class RGWAccessKeyPool
441 RGWUser
*user
{nullptr};
443 std::map
<std::string
, int, ltstr_nocase
> key_type_map
;
445 rgw::sal::Driver
* driver
{nullptr};
447 std::map
<std::string
, RGWAccessKey
> *swift_keys
{nullptr};
448 std::map
<std::string
, RGWAccessKey
> *access_keys
{nullptr};
450 // we don't want to allow keys for the anonymous user or a null user
451 bool keys_allowed
{false};
454 int create_key(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
455 int generate_key(const DoutPrefixProvider
*dpp
,
456 RGWUserAdminOpState
& op_state
, optional_yield y
,
457 std::string
*err_msg
= NULL
);
458 int modify_key(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
460 int check_key_owner(RGWUserAdminOpState
& op_state
);
461 bool check_existing_key(RGWUserAdminOpState
& op_state
);
462 int check_op(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
464 /* API Contract Fulfilment */
465 int execute_add(const DoutPrefixProvider
*dpp
,
466 RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
467 bool defer_save
, optional_yield y
);
468 int execute_remove(const DoutPrefixProvider
*dpp
,
469 RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
470 bool defer_save
, optional_yield y
);
471 int remove_subuser_keys(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
472 bool defer_save
, optional_yield y
);
474 int add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
476 int remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
477 bool defer_save
, optional_yield y
);
479 explicit RGWAccessKeyPool(RGWUser
* usr
);
481 int init(RGWUserAdminOpState
& op_state
);
483 /* API Contracted Methods */
484 int add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
,
485 std::string
*err_msg
= NULL
);
486 int remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
,
487 std::string
*err_msg
= NULL
);
489 friend class RGWUser
;
490 friend class RGWSubUserPool
;
495 RGWUser
*user
{nullptr};
498 rgw::sal::Driver
* driver
{nullptr};
499 bool subusers_allowed
{false};
501 std::map
<std::string
, RGWSubUser
> *subuser_map
{nullptr};
504 int check_op(RGWUserAdminOpState
& op_state
, std::string
*err_msg
= NULL
);
506 /* API Contract Fulfillment */
507 int execute_add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
508 int execute_remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
509 int execute_modify(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
511 int add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
513 int remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
, optional_yield y
);
514 int modify(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
, bool defer_save
);
516 explicit RGWSubUserPool(RGWUser
*user
);
518 bool exists(std::string subuser
);
519 int init(RGWUserAdminOpState
& op_state
);
521 /* API contracted methods */
522 int add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
,
523 std::string
*err_msg
= NULL
);
524 int remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
525 int modify(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
527 friend class RGWUser
;
532 RGWUserCaps
*caps
{nullptr};
533 bool caps_allowed
{false};
534 RGWUser
*user
{nullptr};
537 int add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
539 int remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, bool defer_save
,
543 explicit RGWUserCapPool(RGWUser
*user
);
545 int init(RGWUserAdminOpState
& op_state
);
547 /* API contracted methods */
548 int add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
,
549 std::string
*err_msg
= NULL
);
550 int remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
552 friend class RGWUser
;
559 RGWUserInfo old_info
;
560 rgw::sal::Driver
* driver
{nullptr};
563 bool info_stored
{false};
565 void set_populated() { info_stored
= true; }
566 void clear_populated() { info_stored
= false; }
567 bool is_populated() { return info_stored
; }
569 int check_op(RGWUserAdminOpState
& req
, std::string
*err_msg
);
570 int update(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, optional_yield y
);
572 void clear_members();
575 /* API Contract Fulfillment */
576 int execute_add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
,
578 int execute_remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
,
579 std::string
*err_msg
, optional_yield y
);
580 int execute_modify(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, optional_yield y
);
581 int execute_rename(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, std::string
*err_msg
, optional_yield y
);
586 int init(const DoutPrefixProvider
*dpp
, rgw::sal::Driver
* storage
, RGWUserAdminOpState
& op_state
,
589 int init_storage(rgw::sal::Driver
* storage
);
590 int init(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
);
591 int init_members(RGWUserAdminOpState
& op_state
);
593 rgw::sal::Driver
* get_driver() { return driver
; }
595 /* API Contracted Members */
597 RGWAccessKeyPool keys
;
598 RGWSubUserPool subusers
;
600 /* API Contracted Methods */
601 int add(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
603 int remove(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
605 int rename(RGWUserAdminOpState
& op_state
, optional_yield y
, const DoutPrefixProvider
*dpp
, std::string
*err_msg
= NULL
);
607 /* remove an already populated RGWUser */
608 int remove(std::string
*err_msg
= NULL
);
610 int modify(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, optional_yield y
, std::string
*err_msg
= NULL
);
612 /* retrieve info from an existing user in the RGW system */
613 int info(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, RGWUserInfo
& fetched_info
, optional_yield y
,
614 std::string
*err_msg
= NULL
);
616 /* info from an already populated RGWUser */
617 int info (RGWUserInfo
& fetched_info
, std::string
*err_msg
= NULL
);
619 /* list the existing users */
620 int list(const DoutPrefixProvider
*dpp
, RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
);
622 friend class RGWAccessKeyPool
;
623 friend class RGWSubUserPool
;
624 friend class RGWUserCapPool
;
627 /* Wrappers for admin API functionality */
629 class RGWUserAdminOp_User
632 static int list(const DoutPrefixProvider
*dpp
, rgw::sal::Driver
* driver
,
633 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
);
635 static int info(const DoutPrefixProvider
*dpp
,
636 rgw::sal::Driver
* driver
,
637 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
640 static int create(const DoutPrefixProvider
*dpp
,
641 rgw::sal::Driver
* driver
,
642 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
645 static int modify(const DoutPrefixProvider
*dpp
,
646 rgw::sal::Driver
* driver
,
647 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
, optional_yield y
);
649 static int remove(const DoutPrefixProvider
*dpp
, rgw::sal::Driver
* driver
,
650 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
, optional_yield y
);
653 class RGWUserAdminOp_Subuser
656 static int create(const DoutPrefixProvider
*dpp
,
657 rgw::sal::Driver
* driver
,
658 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
661 static int modify(const DoutPrefixProvider
*dpp
,
662 rgw::sal::Driver
* driver
,
663 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
666 static int remove(const DoutPrefixProvider
*dpp
,
667 rgw::sal::Driver
* driver
,
668 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
672 class RGWUserAdminOp_Key
675 static int create(const DoutPrefixProvider
*dpp
, rgw::sal::Driver
* driver
,
676 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
679 static int remove(const DoutPrefixProvider
*dpp
,
680 rgw::sal::Driver
* driver
,
681 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
685 class RGWUserAdminOp_Caps
688 static int add(const DoutPrefixProvider
*dpp
,
689 rgw::sal::Driver
* driver
,
690 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
693 static int remove(const DoutPrefixProvider
*dpp
,
694 rgw::sal::Driver
* driver
,
695 RGWUserAdminOpState
& op_state
, RGWFormatterFlusher
& flusher
,
699 struct RGWUserCompleteInfo
{
701 std::map
<std::string
, bufferlist
> attrs
;
702 bool has_attrs
{false};
704 void dump(Formatter
* const f
) const {
706 encode_json("attrs", attrs
, f
);
709 void decode_json(JSONObj
*obj
) {
710 decode_json_obj(info
, obj
);
711 has_attrs
= JSONDecoder::decode_json("attrs", attrs
, obj
);
715 class RGWUserMetadataObject
: public RGWMetadataObject
{
716 RGWUserCompleteInfo uci
;
718 RGWUserMetadataObject() {}
719 RGWUserMetadataObject(const RGWUserCompleteInfo
& _uci
, const obj_version
& v
, real_time m
)
725 void dump(Formatter
*f
) const override
{
729 RGWUserCompleteInfo
& get_uci() {
734 class RGWUserMetadataHandler
;
739 RGWSI_Zone
*zone
{nullptr};
740 RGWSI_User
*user
{nullptr};
744 RGWBucketCtl
*bucket
{nullptr};
747 RGWUserMetadataHandler
*umhandler
;
748 RGWSI_MetaBackend_Handler
*be_handler
{nullptr};
751 RGWUserCtl(RGWSI_Zone
*zone_svc
,
752 RGWSI_User
*user_svc
,
753 RGWUserMetadataHandler
*_umhandler
);
755 void init(RGWBucketCtl
*bucket_ctl
) {
756 ctl
.bucket
= bucket_ctl
;
759 RGWBucketCtl
*get_bucket_ctl() {
764 RGWObjVersionTracker
*objv_tracker
{nullptr};
765 ceph::real_time
*mtime
{nullptr};
766 rgw_cache_entry_info
*cache_info
{nullptr};
767 std::map
<std::string
, bufferlist
> *attrs
{nullptr};
771 GetParams
& set_objv_tracker(RGWObjVersionTracker
*_objv_tracker
) {
772 objv_tracker
= _objv_tracker
;
776 GetParams
& set_mtime(ceph::real_time
*_mtime
) {
781 GetParams
& set_cache_info(rgw_cache_entry_info
*_cache_info
) {
782 cache_info
= _cache_info
;
786 GetParams
& set_attrs(std::map
<std::string
, bufferlist
> *_attrs
) {
793 RGWUserInfo
*old_info
{nullptr};
794 RGWObjVersionTracker
*objv_tracker
{nullptr};
795 ceph::real_time mtime
;
796 bool exclusive
{false};
797 std::map
<std::string
, bufferlist
> *attrs
{nullptr};
801 PutParams
& set_old_info(RGWUserInfo
*_info
) {
806 PutParams
& set_objv_tracker(RGWObjVersionTracker
*_objv_tracker
) {
807 objv_tracker
= _objv_tracker
;
811 PutParams
& set_mtime(const ceph::real_time
& _mtime
) {
816 PutParams
& set_exclusive(bool _exclusive
) {
817 exclusive
= _exclusive
;
821 PutParams
& set_attrs(std::map
<std::string
, bufferlist
> *_attrs
) {
827 struct RemoveParams
{
828 RGWObjVersionTracker
*objv_tracker
{nullptr};
832 RemoveParams
& set_objv_tracker(RGWObjVersionTracker
*_objv_tracker
) {
833 objv_tracker
= _objv_tracker
;
838 int get_info_by_uid(const DoutPrefixProvider
*dpp
,
839 const rgw_user
& uid
, RGWUserInfo
*info
,
840 optional_yield y
, const GetParams
& params
= {});
841 int get_info_by_email(const DoutPrefixProvider
*dpp
,
842 const std::string
& email
, RGWUserInfo
*info
,
843 optional_yield y
, const GetParams
& params
= {});
844 int get_info_by_swift(const DoutPrefixProvider
*dpp
,
845 const std::string
& swift_name
, RGWUserInfo
*info
,
846 optional_yield y
, const GetParams
& params
= {});
847 int get_info_by_access_key(const DoutPrefixProvider
*dpp
,
848 const std::string
& access_key
, RGWUserInfo
*info
,
849 optional_yield y
, const GetParams
& params
= {});
851 int get_attrs_by_uid(const DoutPrefixProvider
*dpp
,
852 const rgw_user
& user_id
,
853 std::map
<std::string
, bufferlist
> *attrs
,
855 RGWObjVersionTracker
*objv_tracker
= nullptr);
857 int store_info(const DoutPrefixProvider
*dpp
,
858 const RGWUserInfo
& info
, optional_yield y
,
859 const PutParams
& params
= {});
860 int remove_info(const DoutPrefixProvider
*dpp
,
861 const RGWUserInfo
& info
, optional_yield y
,
862 const RemoveParams
& params
= {});
864 int list_buckets(const DoutPrefixProvider
*dpp
,
865 const rgw_user
& user
,
866 const std::string
& marker
,
867 const std::string
& end_marker
,
870 RGWUserBuckets
*buckets
,
873 uint64_t default_max
= 1000);
875 int read_stats(const DoutPrefixProvider
*dpp
,
876 const rgw_user
& user
, RGWStorageStats
*stats
,
878 ceph::real_time
*last_stats_sync
= nullptr, /* last time a full stats sync completed */
879 ceph::real_time
*last_stats_update
= nullptr); /* last time a stats update was done */
882 class RGWUserMetaHandlerAllocator
{
884 static RGWMetadataHandler
*alloc(RGWSI_User
*user_svc
);