This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 8172d672a [KYUUBI #4540][FOLLOWUP] Create session limiter if user 
unlimited list or deny list nonempty
8172d672a is described below

commit 8172d672a53843c6cded6de1bd6aef353ec822fd
Author: fwang12 <[email protected]>
AuthorDate: Fri Sep 1 03:12:39 2023 +0800

    [KYUUBI #4540][FOLLOWUP] Create session limiter if user unlimited list or 
deny list nonempty
    
    ### _Why are the changes needed?_
    
    We shall create session limiter if user unlimited list or deny list 
nonempty.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    Closes #5215 from turboFei/typo_deny.
    
    Closes #4540
    
    c26dec74e [fwang12] comments
    01fc61619 [fwang12] fix typo
    
    Authored-by: fwang12 <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../org/apache/kyuubi/session/KyuubiSessionManager.scala      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
index 965469deb..19259bb1b 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
@@ -385,14 +385,17 @@ class KyuubiSessionManager private (name: String) extends 
SessionManager(name) {
       ipAddressLimit: Int,
       userIpAddressLimit: Int,
       userUnlimitedList: Set[String],
-      userLimitedList: Set[String]): Option[SessionLimiter] = {
-    Seq(userLimit, ipAddressLimit, userIpAddressLimit).find(_ > 0).map(_ =>
-      SessionLimiter(
+      userDenyList: Set[String]): Option[SessionLimiter] = {
+    if (Seq(userLimit, ipAddressLimit, userIpAddressLimit).exists(_ > 0) || 
userDenyList.nonEmpty) {
+      Some(SessionLimiter(
         userLimit,
         ipAddressLimit,
         userIpAddressLimit,
         userUnlimitedList,
-        userLimitedList))
+        userDenyList))
+    } else {
+      None
+    }
   }
 
   private def startEngineAliveChecker(): Unit = {

Reply via email to