sandynz commented on code in PR #23627:
URL: https://github.com/apache/shardingsphere/pull/23627#discussion_r1073333304


##########
proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/CDCChannelInboundHandler.java:
##########
@@ -164,22 +201,27 @@ private void processStartSubscription(final 
ChannelHandlerContext ctx, final CDC
                     .addListener(ChannelFutureListener.CLOSE);
             return;
         }
+        checkPrivileges(connectionContext.getCurrentUser().getGrantee(), 
startSubscriptionRequest.getDatabase());
         CDCResponse response = backendHandler.startSubscription(request, 
ctx.channel(), connectionContext);
         ctx.writeAndFlush(response);
     }
     
-    private void stopStartSubscription(final ChannelHandlerContext ctx, final 
CDCRequest request, final CDCConnectionContext connectionContext) {
+    private void processStopSubscription(final ChannelHandlerContext ctx, 
final CDCRequest request, final CDCConnectionContext connectionContext) {
+        StopSubscriptionRequest stopSubscriptionRequest = 
request.getStopSubscription();
+        checkPrivileges(connectionContext.getCurrentUser().getGrantee(), 
stopSubscriptionRequest.getDatabase());
         backendHandler.stopSubscription(connectionContext.getJobId());
         connectionContext.setStatus(CDCConnectionStatus.LOGGED_IN);
         
ctx.writeAndFlush(CDCResponseGenerator.succeedBuilder(request.getRequestId()).build());
     }
     
-    private void dropStartSubscription(final ChannelHandlerContext ctx, final 
CDCRequest request, final CDCConnectionContext connectionContext) {
+    private void processDropSubscription(final ChannelHandlerContext ctx, 
final CDCRequest request, final CDCConnectionContext connectionContext) {
+        DropSubscriptionRequest dropSubscriptionRequest = 
request.getDropSubscription();
+        checkPrivileges(connectionContext.getCurrentUser().getGrantee(), 
dropSubscriptionRequest.getDatabase());
         try {
             backendHandler.dropSubscription(connectionContext.getJobId());
             
ctx.writeAndFlush(CDCResponseGenerator.succeedBuilder(request.getRequestId()).build());
         } catch (final SQLException ex) {
-            
ctx.writeAndFlush(CDCResponseGenerator.failed(request.getRequestId(), 
CDCResponseErrorCode.SERVER_ERROR, ex.getMessage()));
+            
ctx.writeAndFlush(CDCResponseGenerator.failed(request.getRequestId(), 
CDCResponseErrorCode.SERVER_ERROR, 
ex.getMessage())).addListener(ChannelFutureListener.CLOSE);
         }

Review Comment:
   OK. We could add TODO in code for now



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to