Skip to content

Commit 610d4a2

Browse files
committed
check flow and group name on addToGroup
1 parent ca196a9 commit 610d4a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/main/java/com/flowci/core/flow/service/FlowGroupServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.flowci.core.flow.dao.FlowUserDao;
77
import com.flowci.core.flow.domain.Flow;
88
import com.flowci.core.flow.domain.FlowGroup;
9+
import com.flowci.exception.ArgumentException;
910
import com.flowci.exception.DuplicateException;
1011
import com.flowci.exception.NotFoundException;
1112
import com.google.common.collect.Sets;
@@ -65,6 +66,10 @@ public FlowGroup create(String name) {
6566

6667
@Override
6768
public void addToGroup(String flowName, String groupName) {
69+
if (flowName.equals(groupName)) {
70+
throw new ArgumentException("Cannot add to same group");
71+
}
72+
6873
var group = get(groupName);
6974
var flow = getFlow(flowName);
7075
flow.setParentId(group.getId());

0 commit comments

Comments
 (0)