blob: 5e78eda61e9ce38889cdf5059445aaab0353c36d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp
#pragma once
#include "rgw_arn.h"
#include "rgw_rest.h"
#include "rgw_user_types.h"
#include "rgw_sal_fwd.h"
class RGWRestUserPolicy : public RGWRESTOp {
protected:
RGWRestUserPolicy(uint64_t action, uint32_t perm);
uint64_t action;
uint32_t perm;
rgw_account_id account_id;
std::unique_ptr<rgw::sal::User> user;
rgw::ARN user_arn;
std::string policy_name;
std::string user_name;
std::string policy;
virtual int get_params();
bool validate_input();
public:
int init_processing(optional_yield y) override;
int check_caps(const RGWUserCaps& caps) override;
int verify_permission(optional_yield y) override;
void send_response() override;
};
class RGWPutUserPolicy : public RGWRestUserPolicy {
bufferlist post_body;
int get_params() override;
int forward_to_master(optional_yield y, const rgw::SiteConfig& site);
public:
RGWPutUserPolicy(const ceph::bufferlist& post_body);
void execute(optional_yield y) override;
const char* name() const override { return "put_user_policy"; }
RGWOpType get_type() override { return RGW_OP_PUT_USER_POLICY; }
};
class RGWGetUserPolicy : public RGWRestUserPolicy {
int get_params() override;
public:
RGWGetUserPolicy();
void execute(optional_yield y) override;
const char* name() const override { return "get_user_policy"; }
RGWOpType get_type() override { return RGW_OP_GET_USER_POLICY; }
};
class RGWListUserPolicies : public RGWRestUserPolicy {
std::string marker;
int max_items = 100;
int get_params() override;
public:
RGWListUserPolicies();
void execute(optional_yield y) override;
const char* name() const override { return "list_user_policies"; }
RGWOpType get_type() override { return RGW_OP_LIST_USER_POLICIES; }
};
class RGWDeleteUserPolicy : public RGWRestUserPolicy {
bufferlist post_body;
int get_params() override;
int forward_to_master(optional_yield y, const rgw::SiteConfig& site);
public:
RGWDeleteUserPolicy(const ceph::bufferlist& post_body);
void execute(optional_yield y) override;
const char* name() const override { return "delete_user_policy"; }
RGWOpType get_type() override { return RGW_OP_DELETE_USER_POLICY; }
};
RGWOp* make_iam_attach_user_policy_op(const ceph::bufferlist& post_body);
RGWOp* make_iam_detach_user_policy_op(const ceph::bufferlist& post_body);
RGWOp* make_iam_list_attached_user_policies_op(const ceph::bufferlist& unused);
|