[ https://issues.apache.org/jira/browse/CLOUDSTACK-10344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16413771#comment-16413771 ]
ASF GitHub Bot commented on CLOUDSTACK-10344: --------------------------------------------- rafaelweingartner commented on a change in pull request #2511: [CLOUDSTACK-10344] bug when moving ACL rules (change order with drag and drop) URL: https://github.com/apache/cloudstack/pull/2511#discussion_r177071282 ########## File path: api/src/main/java/org/apache/cloudstack/api/command/user/network/MoveNetworkAclItemCmd.java ########## @@ -0,0 +1,96 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.network; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseAsyncCustomIdCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.NetworkACLItemResponse; +import org.apache.cloudstack.context.CallContext; +import org.apache.log4j.Logger; + +import com.cloud.event.EventTypes; +import com.cloud.network.vpc.NetworkACLItem; +import com.cloud.user.Account; + +@APICommand(name = "moveNetworkAclItem", description = "Move an ACL rule to a position bettwen two other ACL rules of the same ACL network list", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +public class MoveNetworkAclItemCmd extends BaseAsyncCustomIdCmd { + + public static final Logger s_logger = Logger.getLogger(MoveNetworkAclItemCmd.class.getName()); + private static final String s_name = "moveNetworkAclItemResponse"; + + @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, description = "The ID of the network ACL rule that is being moved to a new position.") + private String uuidRuleBeingMoved; + + @Parameter(name = ApiConstants.ID_PREVIOUS_ACL_RULE, type = CommandType.STRING, description = "The ID of the first rule that is right before the new position where the rule being moved is going to be placed. This value can be 'NULL' if the rule is being moved to the first position of the network ACL list.") + private String previousAclRuleUuid; + + @Parameter(name = ApiConstants.ID_NEXT_ACL_RULE, type = CommandType.STRING, description = "The ID of the rule that is right after the new position where the rule being moved is going to be placed. This value can be 'NULL' if the rule is being moved to the last position of the network ACL list.") + private String nextAclRuleUuid; Review comment: I thought about that; in practice, we do not need to externalize (show users the ‘number’ field). However, if we remove this option now, this would break/affect some API methods. That is why I preferred to first introduce this new method, and maybe later (ACS 5?!) we can start braking some API methods and remove the ‘number’ field from them. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Sometimes a bug happens when moving ACL rules (changing their order with drag > and drop) > ---------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-10344 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10344 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Rafael Weingärtner > Assignee: Rafael Weingärtner > Priority: Major > Fix For: 4.12 > > > An error is happening in certain conditions, such as when you have only 2 ACL > rules and you move the last one to the top. There are other conditions, for > instance, when moving ACLs that are in a sequence of numbers without gaps. > Example, rules: > number | rule > 1 - rule A > 2 - rule D > 3 - rule B > 4 - rule C > 5 - rule E > It is not possible to move "rule C" in position 2, 1, and 3. -- This message was sent by Atlassian JIRA (v7.6.3#76005)