1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
8 #include "rgw_user_types.h"
9 #include "rgw_sal_fwd.h"
11 class RGWRestUserPolicy
: public RGWRESTOp
{
13 RGWRestUserPolicy(uint64_t action
, uint32_t perm
);
17 rgw_account_id account_id
;
18 std::unique_ptr
<rgw::sal::User
> user
;
20 std::string policy_name
;
21 std::string user_name
;
24 virtual int get_params();
25 bool validate_input();
28 int init_processing(optional_yield y
) override
;
29 int check_caps(const RGWUserCaps
& caps
) override
;
30 int verify_permission(optional_yield y
) override
;
31 void send_response() override
;
34 class RGWPutUserPolicy
: public RGWRestUserPolicy
{
36 int get_params() override
;
37 int forward_to_master(optional_yield y
, const rgw::SiteConfig
& site
);
39 RGWPutUserPolicy(const ceph::bufferlist
& post_body
);
40 void execute(optional_yield y
) override
;
41 const char* name() const override
{ return "put_user_policy"; }
42 RGWOpType
get_type() override
{ return RGW_OP_PUT_USER_POLICY
; }
45 class RGWGetUserPolicy
: public RGWRestUserPolicy
{
46 int get_params() override
;
49 void execute(optional_yield y
) override
;
50 const char* name() const override
{ return "get_user_policy"; }
51 RGWOpType
get_type() override
{ return RGW_OP_GET_USER_POLICY
; }
54 class RGWListUserPolicies
: public RGWRestUserPolicy
{
57 int get_params() override
;
59 RGWListUserPolicies();
60 void execute(optional_yield y
) override
;
61 const char* name() const override
{ return "list_user_policies"; }
62 RGWOpType
get_type() override
{ return RGW_OP_LIST_USER_POLICIES
; }
65 class RGWDeleteUserPolicy
: public RGWRestUserPolicy
{
67 int get_params() override
;
68 int forward_to_master(optional_yield y
, const rgw::SiteConfig
& site
);
70 RGWDeleteUserPolicy(const ceph::bufferlist
& post_body
);
71 void execute(optional_yield y
) override
;
72 const char* name() const override
{ return "delete_user_policy"; }
73 RGWOpType
get_type() override
{ return RGW_OP_DELETE_USER_POLICY
; }
76 RGWOp
* make_iam_attach_user_policy_op(const ceph::bufferlist
& post_body
);
77 RGWOp
* make_iam_detach_user_policy_op(const ceph::bufferlist
& post_body
);
78 RGWOp
* make_iam_list_attached_user_policies_op(const ceph::bufferlist
& unused
);