1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_RGW_ACL_S3_H
5 #define CEPH_RGW_ACL_S3_H
10 #include <include/types.h>
12 #include "include/str_list.h"
18 class ACLPermission_S3 : public ACLPermission, public XMLObj
22 ~ACLPermission_S3() override {}
24 bool xml_end(const char *el) override;
25 void to_xml(ostream& out);
28 class ACLGrantee_S3 : public ACLGrantee, public XMLObj
32 ~ACLGrantee_S3() override {}
34 bool xml_start(const char *el, const char **attr);
38 class ACLGrant_S3 : public ACLGrant, public XMLObj
42 ~ACLGrant_S3() override {}
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);
48 static ACLGroupTypeEnum uri_to_group(string& uri);
49 static bool group_to_uri(ACLGroupTypeEnum group, string& uri);
52 class RGWAccessControlList_S3 : public RGWAccessControlList, public XMLObj
55 explicit RGWAccessControlList_S3(CephContext *_cct) : RGWAccessControlList(_cct) {}
56 ~RGWAccessControlList_S3() override {}
58 bool xml_end(const char *el) override;
59 void to_xml(ostream& out);
61 int create_canned(ACLOwner& owner, ACLOwner& bucket_owner, const string& canned_acl);
62 int create_from_grants(std::list<ACLGrant>& grants);
65 class ACLOwner_S3 : public ACLOwner, public XMLObj
69 ~ACLOwner_S3() override {}
71 bool xml_end(const char *el) override;
72 void to_xml(ostream& out);
77 class RGWAccessControlPolicy_S3 : public RGWAccessControlPolicy, public XMLObj
80 explicit RGWAccessControlPolicy_S3(CephContext *_cct) : RGWAccessControlPolicy(_cct) {}
81 ~RGWAccessControlPolicy_S3() override {}
83 bool xml_end(const char *el) override;
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;
89 virtual int create_canned(ACLOwner& _owner, ACLOwner& bucket_owner, string canned_acl) {
90 RGWAccessControlList_S3& _acl = static_cast<RGWAccessControlList_S3 &>(acl);
91 int ret = _acl.create_canned(_owner, bucket_owner, canned_acl);
95 int create_from_headers(RGWRados *store, const RGWEnv *env, ACLOwner& _owner);
99 * Interfaces with the webserver's XML handling code
100 * to parse it in a way that makes sense for the rgw.
102 class RGWACLXMLParser_S3 : public RGWXMLParser
106 XMLObj *alloc_obj(const char *el) override;
108 explicit RGWACLXMLParser_S3(CephContext *_cct) : cct(_cct) {}