app/controllers/miq_policy_controller/conditions.rb
# Remove a condition from a policy
Remove a condition from a policy
Remove a condition from a policy
def condition_remove
    assert_privileges("condition_remove")
    policy = MiqPolicy.find(params[:policy_id])
    condition = Condition.find(params[:id])
    cdesc = condition.description
    policy.conditions.delete(Condition.find(params[:id]))
    AuditEvent.success(:event        => "miqpolicy_condition_removed",
                       :target_id    => policy.id,
                       :target_class => "MiqPolicy",
                       :userid       => session[:userid],
                       :message      => _("Condition record ID %{param_id} was removed from Policy ID %{policy_id}")) %
                                          {:param_id => params[:id], :policy_id => policy.id}
    add_flash(_("Condition \"%{cond_name}\" has been removed from Policy \"%{pol_name}\"") % {:cond_name => cdesc, :pol_name => policy.description})
    policy_get_info(policy)
    @nodetype = "p"
    nodes = x_node.split("_")
    nodes.pop
    @new_policy_node = self.x_node = nodes.join("_")
    replace_right_cell("p", [:policy_profile, :policy])
  end
def condition_remove assert_privileges ( "condition_remove" ) policy = MiqPolicy . find ( params [ :policy_id ] ) condition = Condition . find ( params [ :id ] ) cdesc = condition . description policy . conditions . delete ( Condition . find ( params [ :id ] ) ) AuditEvent . success ( :event => "miqpolicy_condition_removed" , :target_id => policy . id , :target_class => "MiqPolicy" , :userid => session [ :userid ] , :message => _ ( "Condition record ID %{param_id} was removed from Policy ID %{policy_id}" ) ) % { :param_id => params [ :id ] , :policy_id => policy . id } add_flash ( _ ( "Condition \"%{cond_name}\" has been removed from Policy \"%{pol_name}\"" ) % { :cond_name => cdesc , :pol_name => policy . description } ) policy_get_info ( policy ) @nodetype = "p" nodes = x_node . split ( "_" ) nodes . pop @new_policy_node = self . x_node = nodes . join ( "_" ) replace_right_cell ( "p" , [ :policy_profile , :policy ] ) end
Remove a condition from a policy
Remove a condition from a policy