wForget commented on code in PR #7081:
URL: https://github.com/apache/kyuubi/pull/7081#discussion_r2135343043


##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/ranger/AccessRequest.scala:
##########
@@ -68,17 +69,39 @@ object AccessRequest {
     req
   }
 
+  private val getRolesFromUserAndGroupsMethod: Option[UnboundMethod] = {
+    try {
+      Some(DynMethods.builder("getRolesFromUserAndGroups")
+        .hiddenImpl(SparkRangerAdminPlugin.getClass, classOf[String], 
classOf[JSet[String]])
+        .impl(SparkRangerAdminPlugin.getClass, classOf[String], 
classOf[JSet[String]])
+        .buildChecked)
+    } catch {
+      case _: Exception => None
+    }
+  }
+
+  private val setUserRolesMethod: Option[UnboundMethod] = {
+    try {
+      Some(DynMethods.builder("setUserRoles")
+        .hiddenImpl(classOf[AccessRequest], classOf[JSet[String]])
+        .impl(classOf[AccessRequest], classOf[JSet[String]])
+        .buildChecked)
+    } catch {
+      case _: Exception => None
+    }
+  }
+
   private def getUserGroupsFromUgi(user: UserGroupInformation): JSet[String] = 
{
     user.getGroupNames.toSet.asJava
   }
 
-  private def getUserGroupsFromUserStore(user: UserGroupInformation): 
Option[JSet[String]] = {
+  private lazy val userGroupMappingOpt: Option[JHashMap[String, JSet[String]]] 
= {

Review Comment:
   > I'm not sure if this is safe to cache
   
   `userGroupMapping` may be updated by 
[RangerUserStoreRefresher](https://github.com/apache/ranger/blob/master/agents-common/src/main/java/org/apache/ranger/plugin/contextenricher/RangerUserStoreRefresher.java),
 I will only cache reflect methods



-- 
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: notifications-unsubscr...@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org
For additional commands, e-mail: notifications-h...@kyuubi.apache.org

Reply via email to