You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2023/03/14 06:12:24 UTC
[kyuubi] branch master updated: [KYUUBI #4501] Allow administrator to specify the user for engine admin
This is an automated email from the ASF dual-hosted git repository.
feiwang 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 d626c9fbd [KYUUBI #4501] Allow administrator to specify the user for engine admin
d626c9fbd is described below
commit d626c9fbd83c9a3e41b72cf6fe0e786aafa31172
Author: fwang12 <fw...@ebay.com>
AuthorDate: Tue Mar 14 14:12:16 2023 +0800
[KYUUBI #4501] Allow administrator to specify the user for engine admin
### _Why are the changes needed?_
### _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
- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #4501 from turboFei/engine_admin.
Closes #4501
82a0b9687 [fwang12] get username
Authored-by: fwang12 <fw...@ebay.com>
Signed-off-by: fwang12 <fw...@ebay.com>
---
.../org/apache/kyuubi/server/api/v1/AdminResource.scala | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala
index 4418bc8d6..e5401ca41 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala
@@ -196,7 +196,11 @@ private[v1] class AdminResource extends ApiRequestContext with Logging {
@QueryParam("sharelevel") shareLevel: String,
@QueryParam("subdomain") subdomain: String,
@QueryParam("hive.server2.proxy.user") hs2ProxyUser: String): Response = {
- val userName = fe.getSessionUser(hs2ProxyUser)
+ val userName = if (isAdministrator(fe.getRealUser())) {
+ Option(hs2ProxyUser).getOrElse(fe.getRealUser())
+ } else {
+ fe.getSessionUser(hs2ProxyUser)
+ }
val engine = getEngine(userName, engineType, shareLevel, subdomain, "default")
val engineSpace = getEngineSpace(engine)
@@ -230,7 +234,11 @@ private[v1] class AdminResource extends ApiRequestContext with Logging {
@QueryParam("sharelevel") shareLevel: String,
@QueryParam("subdomain") subdomain: String,
@QueryParam("hive.server2.proxy.user") hs2ProxyUser: String): Seq[Engine] = {
- val userName = fe.getSessionUser(hs2ProxyUser)
+ val userName = if (isAdministrator(fe.getRealUser())) {
+ Option(hs2ProxyUser).getOrElse(fe.getRealUser())
+ } else {
+ fe.getSessionUser(hs2ProxyUser)
+ }
val engine = getEngine(userName, engineType, shareLevel, subdomain, "")
val engineSpace = getEngineSpace(engine)