fix: allow delete shared role and policy

This commit is contained in:
Qiu Jian
2020-08-15 21:04:48 +08:00
parent 3bc1381c36
commit b41bd4066c
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")
}