]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_acl_s3.h
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / rgw / rgw_acl_s3.h
CommitLineData
7c673cae 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
7c673cae 3
1e59de90 4#pragma once
7c673cae
FG
5
6#include <map>
7#include <string>
8#include <iosfwd>
9#include <include/types.h>
10
11#include "include/str_list.h"
12#include "rgw_xml.h"
13#include "rgw_acl.h"
1e59de90 14#include "rgw_sal_fwd.h"
7c673cae 15
9f95a23c 16class RGWUserCtl;
7c673cae
FG
17
18class ACLPermission_S3 : public ACLPermission, public XMLObj
19{
20public:
21 ACLPermission_S3() {}
1e59de90 22 virtual ~ACLPermission_S3() override {}
7c673cae
FG
23
24 bool xml_end(const char *el) override;
20effc67 25 void to_xml(std::ostream& out);
7c673cae
FG
26};
27
28class ACLGrantee_S3 : public ACLGrantee, public XMLObj
29{
30public:
31 ACLGrantee_S3() {}
1e59de90 32 virtual ~ACLGrantee_S3() override {}
7c673cae
FG
33
34 bool xml_start(const char *el, const char **attr);
35};
36
37
38class ACLGrant_S3 : public ACLGrant, public XMLObj
39{
40public:
41 ACLGrant_S3() {}
1e59de90 42 virtual ~ACLGrant_S3() override {}
7c673cae 43
20effc67 44 void to_xml(CephContext *cct, std::ostream& out);
7c673cae
FG
45 bool xml_end(const char *el) override;
46 bool xml_start(const char *el, const char **attr);
47
20effc67
TL
48 static ACLGroupTypeEnum uri_to_group(std::string& uri);
49 static bool group_to_uri(ACLGroupTypeEnum group, std::string& uri);
7c673cae
FG
50};
51
52class RGWAccessControlList_S3 : public RGWAccessControlList, public XMLObj
53{
54public:
55 explicit RGWAccessControlList_S3(CephContext *_cct) : RGWAccessControlList(_cct) {}
1e59de90 56 virtual ~RGWAccessControlList_S3() override {}
7c673cae
FG
57
58 bool xml_end(const char *el) override;
20effc67 59 void to_xml(std::ostream& out);
7c673cae 60
20effc67 61 int create_canned(ACLOwner& owner, ACLOwner& bucket_owner, const std::string& canned_acl);
7c673cae
FG
62 int create_from_grants(std::list<ACLGrant>& grants);
63};
64
65class ACLOwner_S3 : public ACLOwner, public XMLObj
66{
67public:
68 ACLOwner_S3() {}
1e59de90 69 virtual ~ACLOwner_S3() override {}
7c673cae
FG
70
71 bool xml_end(const char *el) override;
20effc67 72 void to_xml(std::ostream& out);
7c673cae
FG
73};
74
75class RGWEnv;
76
77class RGWAccessControlPolicy_S3 : public RGWAccessControlPolicy, public XMLObj
78{
79public:
80 explicit RGWAccessControlPolicy_S3(CephContext *_cct) : RGWAccessControlPolicy(_cct) {}
1e59de90 81 virtual ~RGWAccessControlPolicy_S3() override {}
7c673cae
FG
82
83 bool xml_end(const char *el) override;
84
20effc67 85 void to_xml(std::ostream& out);
1e59de90 86 int rebuild(const DoutPrefixProvider *dpp, rgw::sal::Driver* driver, ACLOwner *owner,
20effc67
TL
87 RGWAccessControlPolicy& dest, std::string &err_msg);
88 bool compare_group_name(std::string& id, ACLGroupTypeEnum group) override;
7c673cae 89
20effc67 90 virtual int create_canned(ACLOwner& _owner, ACLOwner& bucket_owner, const std::string& canned_acl) {
7c673cae 91 RGWAccessControlList_S3& _acl = static_cast<RGWAccessControlList_S3 &>(acl);
f67539c2
TL
92 if (_owner.get_id() == rgw_user("anonymous")) {
93 owner = bucket_owner;
94 } else {
95 owner = _owner;
96 }
97 int ret = _acl.create_canned(owner, bucket_owner, canned_acl);
7c673cae
FG
98 return ret;
99 }
1e59de90 100 int create_from_headers(const DoutPrefixProvider *dpp, rgw::sal::Driver* driver,
20effc67 101 const RGWEnv *env, ACLOwner& _owner);
7c673cae
FG
102};
103
104/**
105 * Interfaces with the webserver's XML handling code
106 * to parse it in a way that makes sense for the rgw.
107 */
108class RGWACLXMLParser_S3 : public RGWXMLParser
109{
110 CephContext *cct;
111
112 XMLObj *alloc_obj(const char *el) override;
113public:
114 explicit RGWACLXMLParser_S3(CephContext *_cct) : cct(_cct) {}
115};