return match_owner(o, id, account);
}
+ bool is_root() const override {
+ if (account)
+ return get_identity_type() == TYPE_ROOT;
+
+ return get_perm_mask() == RGW_PERM_FULL_CONTROL;
+ }
+
bool is_identity(const Principal& p) const override {
if (p.is_wildcard()) {
return true;
return info.acct_user == *uid;
}
+bool rgw::auth::RemoteApplier::is_root() const
+{
+ return get_perm_mask() == RGW_PERM_FULL_CONTROL;
+}
+
bool rgw::auth::RemoteApplier::is_identity(const Principal& p) const {
// We also need to cover cases where rgw_keystone_implicit_tenants
// was enabled.
return match_owner(o, user_info.user_id, account);
}
+bool rgw::auth::LocalApplier::is_root() const
+{
+ if (account)
+ return get_identity_type() == TYPE_ROOT;
+
+ return get_perm_mask() == RGW_PERM_FULL_CONTROL;
+}
+
bool rgw::auth::LocalApplier::is_identity(const Principal& p) const {
if (p.is_wildcard()) {
return true;
* On internal error throws rgw::auth::Exception storing the reason. */
virtual bool is_owner_of(const rgw_owner& o) const = 0;
+ /* Verify whether a given identity is the root user. */
+ virtual bool is_root() const = 0;
+
+ /* Verify whether a given identity is the root user and the owner of the
+ * rgw_owner specified in @o. */
+ virtual bool is_root_of(const rgw_owner& o) const {
+ return is_root() && is_owner_of(o);
+ }
+
/* Return the permission mask that is used to narrow down the set of
* operations allowed for a given identity. This method reflects the idea
* of subuser tied to RGWUserInfo. On error throws rgw::auth::Exception
bool is_owner_of(const rgw_owner& o) const override;
+ bool is_root() const override {
+ return false;
+ }
+
uint32_t get_perm_mask() const override {
return RGW_PERM_NONE;
}
uint32_t get_perms_from_aclspec(const DoutPrefixProvider* dpp, const aclspec_t& aclspec) const override;
bool is_admin_of(const rgw_owner& o) const override;
bool is_owner_of(const rgw_owner& o) const override;
+ bool is_root() const override;
bool is_identity(const Principal& p) const override;
uint32_t get_perm_mask() const override { return info.perm_mask; }
uint32_t get_perms_from_aclspec(const DoutPrefixProvider* dpp, const aclspec_t& aclspec) const override;
bool is_admin_of(const rgw_owner& o) const override;
bool is_owner_of(const rgw_owner& o) const override;
+ bool is_root() const override;
bool is_identity(const Principal& p) const override;
uint32_t get_perm_mask() const override {
if (this->perm_mask == RGW_PERM_INVALID) {
return false;
}
bool is_owner_of(const rgw_owner& o) const override;
+ bool is_root() const override {
+ return false;
+ }
bool is_identity(const Principal& p) const override;
uint32_t get_perm_mask() const override {
return RGW_PERM_NONE;