From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/rgw/rgw_rest_user_policy.h | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/rgw/rgw_rest_user_policy.h (limited to 'src/rgw/rgw_rest_user_policy.h') diff --git a/src/rgw/rgw_rest_user_policy.h b/src/rgw/rgw_rest_user_policy.h new file mode 100644 index 00000000..895f4e61 --- /dev/null +++ b/src/rgw/rgw_rest_user_policy.h @@ -0,0 +1,76 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_RGW_REST_USER_POLICY_H +#define CEPH_RGW_REST_USER_POLICY_H + +class RGWRestUserPolicy : public RGWRESTOp { +protected: + static constexpr int MAX_POLICY_NAME_LEN = 128; + string policy_name; + string user_name; + string policy; + + bool validate_input(); + +public: + int verify_permission() override; + virtual uint64_t get_op() = 0; + void send_response() override; + void dump(Formatter *f) const; +}; + +class RGWUserPolicyRead : public RGWRestUserPolicy { +public: + RGWUserPolicyRead() = default; + int check_caps(RGWUserCaps& caps) override; +}; + +class RGWUserPolicyWrite : public RGWRestUserPolicy { +public: + RGWUserPolicyWrite() = default; + int check_caps(RGWUserCaps& caps) override; +}; + +class RGWPutUserPolicy : public RGWUserPolicyWrite { +public: + RGWPutUserPolicy() = default; + void execute() override; + int get_params(); + const char* name() const override { return "put_user-policy"; } + uint64_t get_op() override; + RGWOpType get_type() override { return RGW_OP_PUT_USER_POLICY; } +}; + +class RGWGetUserPolicy : public RGWUserPolicyRead { +public: + RGWGetUserPolicy() = default; + void execute() override; + int get_params(); + const char* name() const override { return "get_user_policy"; } + uint64_t get_op() override; + RGWOpType get_type() override { return RGW_OP_GET_USER_POLICY; } +}; + +class RGWListUserPolicies : public RGWUserPolicyRead { +public: + RGWListUserPolicies() = default; + void execute() override; + int get_params(); + const char* name() const override { return "list_user_policies"; } + uint64_t get_op() override; + RGWOpType get_type() override { return RGW_OP_LIST_USER_POLICIES; } +}; + +class RGWDeleteUserPolicy : public RGWUserPolicyWrite { +public: + RGWDeleteUserPolicy() = default; + void execute() override; + int get_params(); + const char* name() const override { return "delete_user_policy"; } + uint64_t get_op() override; + RGWOpType get_type() override { return RGW_OP_DELETE_USER_POLICY; } +}; + +#endif /* CEPH_RGW_REST_USER_POLICY_H */ + -- cgit v1.2.3