File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1 Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -568,14 +568,20 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging {
568
568
content = Array (new Content (
569
569
mediaType = MediaType .APPLICATION_JSON ,
570
570
schema = new Schema (implementation = classOf [ReassignBatchResponse ]))),
571
- description = " Reassign batches to a new instance" )
571
+ description =
572
+ " Reassign batch sessions on an unreachable kyuubi instance to the current kyuubi instance" )
572
573
@ POST
573
574
@ Path (" /reassign" )
574
575
@ Consumes (Array (MediaType .APPLICATION_JSON ))
575
576
def reassignBatchSessions (request : ReassignBatchRequest ): ReassignBatchResponse = {
577
+ val userName = fe.getSessionUser(Map .empty[String , String ])
578
+ val ipAddress = fe.getIpAddress
576
579
val kyuubiInstance = request.getKyuubiInstance
577
580
val newKyuubiInstance = fe.connectionUrl
578
- info(s " Received request to reassign batch sessions from $kyuubiInstance to $newKyuubiInstance" )
581
+ info(s " Received reassign $kyuubiInstance batch sessions request from $userName/ $ipAddress" )
582
+ if (! fe.isAdministrator(userName)) {
583
+ throw new ForbiddenException (s " $userName is not allowed to reassign the batches " )
584
+ }
579
585
if (kyuubiInstance == newKyuubiInstance) {
580
586
throw new IllegalStateException (s " KyuubiInstance is alive: $kyuubiInstance" )
581
587
}
You can’t perform that action at this time.
0 commit comments