]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
9f95a23c | 2 | // vim: ts=8 sw=2 smarttab ft=cpp |
11fdf7f2 | 3 | |
9f95a23c | 4 | #pragma once |
f67539c2 | 5 | #include "rgw_rest.h" |
11fdf7f2 TL |
6 | |
7 | class RGWRestUserPolicy : public RGWRESTOp { | |
8 | protected: | |
9 | static constexpr int MAX_POLICY_NAME_LEN = 128; | |
20effc67 TL |
10 | std::string policy_name; |
11 | std::string user_name; | |
12 | std::string policy; | |
11fdf7f2 TL |
13 | |
14 | bool validate_input(); | |
15 | ||
16 | public: | |
f67539c2 | 17 | int verify_permission(optional_yield y) override; |
11fdf7f2 TL |
18 | virtual uint64_t get_op() = 0; |
19 | void send_response() override; | |
20 | void dump(Formatter *f) const; | |
21 | }; | |
22 | ||
23 | class RGWUserPolicyRead : public RGWRestUserPolicy { | |
24 | public: | |
25 | RGWUserPolicyRead() = default; | |
9f95a23c | 26 | int check_caps(const RGWUserCaps& caps) override; |
11fdf7f2 TL |
27 | }; |
28 | ||
29 | class RGWUserPolicyWrite : public RGWRestUserPolicy { | |
30 | public: | |
31 | RGWUserPolicyWrite() = default; | |
9f95a23c | 32 | int check_caps(const RGWUserCaps& caps) override; |
11fdf7f2 TL |
33 | }; |
34 | ||
35 | class RGWPutUserPolicy : public RGWUserPolicyWrite { | |
36 | public: | |
37 | RGWPutUserPolicy() = default; | |
f67539c2 | 38 | void execute(optional_yield y) override; |
11fdf7f2 TL |
39 | int get_params(); |
40 | const char* name() const override { return "put_user-policy"; } | |
41 | uint64_t get_op() override; | |
42 | RGWOpType get_type() override { return RGW_OP_PUT_USER_POLICY; } | |
43 | }; | |
44 | ||
45 | class RGWGetUserPolicy : public RGWUserPolicyRead { | |
46 | public: | |
47 | RGWGetUserPolicy() = default; | |
f67539c2 | 48 | void execute(optional_yield y) override; |
11fdf7f2 TL |
49 | int get_params(); |
50 | const char* name() const override { return "get_user_policy"; } | |
51 | uint64_t get_op() override; | |
52 | RGWOpType get_type() override { return RGW_OP_GET_USER_POLICY; } | |
53 | }; | |
54 | ||
55 | class RGWListUserPolicies : public RGWUserPolicyRead { | |
56 | public: | |
57 | RGWListUserPolicies() = default; | |
f67539c2 | 58 | void execute(optional_yield y) override; |
11fdf7f2 TL |
59 | int get_params(); |
60 | const char* name() const override { return "list_user_policies"; } | |
61 | uint64_t get_op() override; | |
62 | RGWOpType get_type() override { return RGW_OP_LIST_USER_POLICIES; } | |
63 | }; | |
64 | ||
65 | class RGWDeleteUserPolicy : public RGWUserPolicyWrite { | |
66 | public: | |
67 | RGWDeleteUserPolicy() = default; | |
f67539c2 | 68 | void execute(optional_yield y) override; |
11fdf7f2 TL |
69 | int get_params(); |
70 | const char* name() const override { return "delete_user_policy"; } | |
71 | uint64_t get_op() override; | |
72 | RGWOpType get_type() override { return RGW_OP_DELETE_USER_POLICY; } | |
73 | }; |