From f5bf9d9c7f6323e6d2a2a6212ddd1e10a8be0991 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 23 Feb 2012 15:34:26 -0800 Subject: [PATCH] rgw: s3 only shows s3 acls Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_acl.h | 2 +- src/rgw/rgw_acl_s3.cc | 7 ++++++- src/rgw/rgw_acl_swift.cc | 4 ++-- src/rgw/rgw_xml.h | 11 ----------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/rgw/rgw_acl.h b/src/rgw/rgw_acl.h index d0c9fcb203008..e8907e8e71491 100644 --- a/src/rgw/rgw_acl.h +++ b/src/rgw/rgw_acl.h @@ -19,7 +19,7 @@ using namespace std; #define RGW_PERM_WRITE_OBJS 0x20 #define RGW_PERM_FULL_CONTROL ( RGW_PERM_READ | RGW_PERM_WRITE | \ RGW_PERM_READ_ACP | RGW_PERM_WRITE_ACP ) -#define RGW_PERM_ALL RGW_PERM_FULL_CONTROL +#define RGW_PERM_ALL_S3 RGW_PERM_FULL_CONTROL enum ACLGranteeTypeEnum { /* numbers are encoded, should not change */ diff --git a/src/rgw/rgw_acl_s3.cc b/src/rgw/rgw_acl_s3.cc index 0b7d8aa5dab77..dff96304eefc4 100644 --- a/src/rgw/rgw_acl_s3.cc +++ b/src/rgw/rgw_acl_s3.cc @@ -195,6 +195,12 @@ bool ACLGrant_S3::xml_end(const char *el) { } void ACLGrant_S3::to_xml(ostream& out) { + ACLPermission_S3& perm = static_cast(permission); + + /* only show s3 compatible permissions */ + if (!(perm.get_permissions() & RGW_PERM_ALL_S3)) + return; + out << "" << ""; switch (type.get_type()) { @@ -214,7 +220,6 @@ void ACLGrant_S3::to_xml(ostream& out) { break; } out << ""; - ACLPermission_S3& perm = static_cast(permission); perm.to_xml(out); out << ""; } diff --git a/src/rgw/rgw_acl_swift.cc b/src/rgw/rgw_acl_swift.cc index c8a217f9821dc..a0038ff9c3382 100644 --- a/src/rgw/rgw_acl_swift.cc +++ b/src/rgw/rgw_acl_swift.cc @@ -9,8 +9,8 @@ using namespace std; -#define SWIFT_PERM_READ RGW_PERM_READ -#define SWIFT_PERM_WRITE RGW_PERM_WRITE +#define SWIFT_PERM_READ RGW_PERM_READ_OBJS +#define SWIFT_PERM_WRITE RGW_PERM_WRITE_OBJS static int parse_list(string& uid_list, vector& uids) { diff --git a/src/rgw/rgw_xml.h b/src/rgw/rgw_xml.h index fc8f23d88da1b..bb59d5ae68cbd 100644 --- a/src/rgw/rgw_xml.h +++ b/src/rgw/rgw_xml.h @@ -11,17 +11,6 @@ using namespace std; -#define RGW_URI_ALL_USERS "http://acs.amazonaws.com/groups/global/AllUsers" -#define RGW_URI_AUTH_USERS "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" - -#define RGW_PERM_READ 0x01 -#define RGW_PERM_WRITE 0x02 -#define RGW_PERM_READ_ACP 0x04 -#define RGW_PERM_WRITE_ACP 0x08 -#define RGW_PERM_FULL_CONTROL ( RGW_PERM_READ | RGW_PERM_WRITE | \ - RGW_PERM_READ_ACP | RGW_PERM_WRITE_ACP ) -#define RGW_PERM_ALL RGW_PERM_FULL_CONTROL - class XMLObj; class XMLObjIter { -- 2.39.5