Merge pull request #7581 from swordqiu/automated-cherry-pick-of-#7580-upstream-release-3.2

Automated cherry pick of #7580: fix: allow delete shared role and policy
This commit is contained in:
Zexi Li
2020-08-16 23:43:24 +08:00
committed by GitHub
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -261,9 +261,9 @@ func (policy *SPolicy) Delete(ctx context.Context, userCred mcclient.TokenCreden
}
func (policy *SPolicy) ValidateDeleteCondition(ctx context.Context) error {
if policy.IsShared() {
return httperrors.NewInvalidStatusError("cannot delete shared policy")
}
// if policy.IsShared() {
// return httperrors.NewInvalidStatusError("cannot delete shared policy")
// }
if policy.Enabled.IsTrue() {
return httperrors.NewInvalidStatusError("cannot delete enabled policy")
}
+3 -3
View File
@@ -188,9 +188,9 @@ func (role *SRole) IsSystemRole() bool {
}
func (role *SRole) ValidateDeleteCondition(ctx context.Context) error {
if role.IsShared() {
return httperrors.NewInvalidStatusError("cannot delete shared role")
}
// if role.IsShared() {
// return httperrors.NewInvalidStatusError("cannot delete shared role")
// }
if role.IsSystemRole() {
return httperrors.NewForbiddenError("cannot delete system role")
}