lasdf1234 commented on code in PR #11848:
URL: https://github.com/apache/gravitino/pull/11848#discussion_r3511224723
##########
core/src/main/java/org/apache/gravitino/authorization/AccessControlDispatcher.java:
##########
@@ -75,6 +103,43 @@ User addUser(String metalake, String user)
*/
User getUser(String metalake, String user) throws NoSuchUserException,
NoSuchMetalakeException;
+ /**
+ * Gets a User by external identifier.
+ *
+ * @param metalake The Metalake of the User.
+ * @param externalId The external identifier of the User.
+ * @return The getting User instance.
+ * @throws NoSuchUserException If the User with the given external id does
not exist.
+ * @throws NoSuchMetalakeException If the Metalake with the given name does
not exist.
+ * @throws RuntimeException If getting the User encounters storage issues.
+ */
+ User getUserByExternalId(String metalake, String externalId)
+ throws NoSuchUserException, NoSuchMetalakeException;
+
+ /**
+ * Enables a User without removing role bindings.
+ *
+ * @param metalake The Metalake of the User.
+ * @param externalId The external identifier of the User.
+ * @return The updated User instance.
+ * @throws NoSuchUserException If the User with the given external id does
not exist.
+ * @throws NoSuchMetalakeException If the Metalake with the given name does
not exist.
+ */
+ User enableUser(String metalake, String externalId)
Review Comment:
The upstream system that call the gravitino interface are all associated
using externalId as the key.
##########
core/src/main/java/org/apache/gravitino/EntityStore.java:
##########
@@ -167,6 +168,66 @@ <E extends Entity & HasIdentifier> E update(
<E extends Entity & HasIdentifier> E get(NameIdentifier ident, EntityType
entityType, Class<E> e)
throws NoSuchEntityException, IOException;
+ /**
+ * Get the entity from the underlying storage by external id within the
namespace.
+ *
+ * @param namespace the namespace of the entity
+ * @param entityType the general type of the entity
+ * @param type the detailed type of the entity
+ * @param externalId the external id of the entity
+ * @param <E> the class of entity
+ * @return the entity retrieved from the underlying storage
+ * @throws NoSuchEntityException if the entity does not exist
+ * @throws IOException if the retrieve operation fails
+ */
+ <E extends Entity & HasIdentifier> E getByExternalId(
+ Namespace namespace, EntityType entityType, Class<E> type, String
externalId)
+ throws NoSuchEntityException, IOException;
+
+ /**
+ * Update the enabled state of a user by external id within the user
namespace.
+ *
+ * @param namespace the user namespace of the metalake
+ * @param externalId the external id of the user
+ * @param enabled the expected enabled state
+ * @return the updated user entity
+ * @throws NoSuchEntityException if the user does not exist
+ * @throws IOException if the update operation fails
+ */
+ default UserEntity updateUserEnabledByExternalId(
Review Comment:
The upstream system that call the gravitino interface are all associated
using externalId as the key.
--
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]