Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-11608][Manager] Add permission verification for ordinary users to create streams and sinks #11609

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ public Integer save(SinkRequest request, String operator) {
// Check if it can be added
String groupId = request.getInlongGroupId();
groupCheckService.checkGroupStatus(groupId, operator);

InlongGroupEntity groupEntity = groupMapper.selectByGroupId(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 create sink info");
// Make sure that there is no same sink name under the current groupId and streamId
String streamId = request.getInlongStreamId();
String sinkName = request.getSinkName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public Integer save(SourceRequest request, String operator) {
// Check if it can be added
String groupId = request.getInlongGroupId();
String streamId = request.getInlongStreamId();
InlongGroupEntity groupEntity = groupMapper.selectByGroupId(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 create source info");
InlongStreamEntity streamEntity = groupCheckService.checkStreamStatus(groupId, streamId, operator);
String sourceName = request.getSourceName();
List<StreamSourceEntity> existList = sourceMapper.selectByRelatedId(groupId, streamId, sourceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,12 @@ public Integer save(InlongStreamRequest request, String operator) {

// Check if it can be added
checkGroupStatusIsTemp(groupId);

InlongGroupEntity groupEntity = groupMapper.selectByGroupId(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 create stream info");
// The streamId under the same groupId cannot be repeated
Integer count = streamMapper.selectExistByIdentifier(groupId, streamId);
if (count >= 1) {
Expand Down
Loading