mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
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:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user