]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_rest_user_policy.h
bump version to 19.2.0-pve1
[ceph.git] / ceph / src / rgw / rgw_rest_user_policy.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
3
4 #pragma once
5
6 #include "rgw_arn.h"
7 #include "rgw_rest.h"
8 #include "rgw_user_types.h"
9 #include "rgw_sal_fwd.h"
10
11 class RGWRestUserPolicy : public RGWRESTOp {
12 protected:
13 RGWRestUserPolicy(uint64_t action, uint32_t perm);
14
15 uint64_t action;
16 uint32_t perm;
17 rgw_account_id account_id;
18 std::unique_ptr<rgw::sal::User> user;
19 rgw::ARN user_arn;
20 std::string policy_name;
21 std::string user_name;
22 std::string policy;
23
24 virtual int get_params();
25 bool validate_input();
26
27 public:
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;
32 };
33
34 class RGWPutUserPolicy : public RGWRestUserPolicy {
35 bufferlist post_body;
36 int get_params() override;
37 int forward_to_master(optional_yield y, const rgw::SiteConfig& site);
38 public:
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; }
43 };
44
45 class RGWGetUserPolicy : public RGWRestUserPolicy {
46 int get_params() override;
47 public:
48 RGWGetUserPolicy();
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; }
52 };
53
54 class RGWListUserPolicies : public RGWRestUserPolicy {
55 std::string marker;
56 int max_items = 100;
57 int get_params() override;
58 public:
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; }
63 };
64
65 class RGWDeleteUserPolicy : public RGWRestUserPolicy {
66 bufferlist post_body;
67 int get_params() override;
68 int forward_to_master(optional_yield y, const rgw::SiteConfig& site);
69 public:
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; }
74 };
75
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);