Skip to content

Commit

Permalink
[INLONG-11195][Manager] Add group check
Browse files Browse the repository at this point in the history
  • Loading branch information
fuweng11 committed Sep 24, 2024
1 parent b95d4e2 commit 0631a99
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ public Boolean update(InlongStreamRequest request, String operator) {
String groupId = request.getInlongGroupId();
Preconditions.expectNotBlank(groupId, ErrorCodeEnum.GROUP_ID_IS_EMPTY);
InlongGroupEntity groupEntity = groupMapper.selectByGroupIdWithoutTenant(groupId);
if (groupEntity == null) {
throw new BusinessException(String.format("InlongGroup does not exist with InlongGroupId=%s", groupId));
}
userService.checkUser(groupEntity.getInCharges(), operator,
"Current user does not have permission to update stream info");

Expand Down Expand Up @@ -522,6 +525,9 @@ public Boolean delete(String groupId, String streamId, String operator) {
// Check if it can be deleted
this.checkGroupStatusIsTemp(groupId);
InlongGroupEntity groupEntity = groupMapper.selectByGroupIdWithoutTenant(groupId);
if (groupEntity == null) {
throw new BusinessException(String.format("InlongGroup does not exist with InlongGroupId=%s", groupId));
}
userService.checkUser(groupEntity.getInCharges(), operator,
"Current user does not have permission to delete stream info");

Expand Down Expand Up @@ -961,6 +967,10 @@ private InlongGroupEntity checkGroupStatusIsTemp(String groupId) {
@Override
public List<BriefMQMessage> listMessages(QueryMessageRequest request, String operator) {
InlongGroupEntity groupEntity = groupMapper.selectByGroupId(request.getGroupId());
if (groupEntity == null) {
throw new BusinessException(
String.format("InlongGroup does not exist with InlongGroupId=%s", request.getGroupId()));
}
userService.checkUser(groupEntity.getInCharges(), operator, String
.format("Current user does not have permission to query message for groupId=%s", request.getGroupId()));
InlongGroupOperator instance = groupOperatorFactory.getInstance(groupEntity.getMqType());
Expand Down

0 comments on commit 0631a99

Please sign in to comment.