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