提交 b804bcc5 编写于 作者: 张乐 提交者: GitHub

Merge pull request #382 from nobodyiam/release-lock-fix

add namespace lock limit in create release service
......@@ -5,6 +5,7 @@ import com.google.gson.Gson;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.Item;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.entity.NamespaceLock;
import com.ctrip.framework.apollo.biz.entity.Release;
import com.ctrip.framework.apollo.biz.repository.ItemRepository;
import com.ctrip.framework.apollo.biz.repository.ReleaseRepository;
......@@ -79,6 +80,10 @@ public class ReleaseService {
@Transactional
public Release buildRelease(String name, String comment, Namespace namespace, String operator) {
NamespaceLock lock = namespaceLockService.findLock(namespace.getId());
if (lock != null && lock.getDataChangeCreatedBy().equals(operator)) {
throw new BadRequestException(String.format("Current editor %s is not allowed to release the config", operator));
}
List<Item> items = itemRepository.findByNamespaceIdOrderByLineNumAsc(namespace.getId());
Map<String, String> configurations = new HashMap<String, String>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册