lasdf1234 commented on code in PR #11848:
URL: https://github.com/apache/gravitino/pull/11848#discussion_r3511370161


##########
core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java:
##########
@@ -145,6 +152,44 @@ public static NameIdentifier ofUser(String metalake, 
String user) {
         metalake, Entity.SYSTEM_CATALOG_RESERVED_NAME, 
Entity.USER_SCHEMA_NAME, user);
   }
 
+  /**
+   * Creates a name identifier for locking or addressing a user by external id.
+   *
+   * <p>The path uses a reserved prefix in the leaf segment so it does not 
collide with {@link
+   * #ofUser(String, String)} when the external id equals a user name.
+   *
+   * @param metalake the metalake name
+   * @param externalId the external id of the user
+   * @return the name identifier of the user external id path
+   */
+  public static NameIdentifier ofUserExternalId(String metalake, String 
externalId) {

Review Comment:
   TreeLockUtils.doWithTreeLock() requires a NameIdentifier as the lock path. 
When operating based on the name, it uses ofUser(metalake, userName); when 
operating based on the external ID, and when the username is not known yet, an 
independent lock path is required.



-- 
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