mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: disable policy update when enable three member system
This commit is contained in:
@@ -687,12 +687,14 @@ func (policy *SPolicy) ValidateUpdateCondition(ctx context.Context) error {
|
||||
//if policy.IsSystem.IsTrue() {
|
||||
// return errors.Wrap(httperrors.ErrForbidden, "system policy")
|
||||
//}
|
||||
rps, err := RolePolicyManager.fetchByPolicyId(policy.Id)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "fetchByPolicyId")
|
||||
}
|
||||
if len(rps) > 0 {
|
||||
return errors.Wrap(httperrors.ErrForbidden, "policy in use")
|
||||
if options.Options.ThreeAdminRoleSystem {
|
||||
rps, err := RolePolicyManager.fetchByPolicyId(policy.Id)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "fetchByPolicyId")
|
||||
}
|
||||
if len(rps) > 0 {
|
||||
return errors.Wrap(httperrors.ErrForbidden, "policy in use")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user