Merge pull request #7580 from swordqiu/hotfix/qj-allow-delete-shared-role-policy

fix: allow delete shared role and policy
This commit is contained in:
Zexi Li
2020-08-16 23:44:10 +08:00
committed by GitHub
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -263,9 +263,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")
}