World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#11919] feat(core): AccessControlEventDispatcher events for external-id APIs (#11920)
MaSai84119161706b
diff --git a/core/src/main/java/org/apache/gravitino/audit/AuditLog.java b/core/src/main/java/org/apache/gravitino/audit/AuditLog.javaindex 54107f6c81..0b431b52f5 100644--- a/core/src/main/java/org/apache/gravitino/audit/AuditLog.java+++ b/core/src/main/java/org/apache/gravitino/audit/AuditLog.java@@ -378,8 +378,16 @@ public interface AuditLog {REMOVE_USER,+ REMOVE_USER_BY_EXTERNAL_ID,+GET_USER,+ GET_USER_BY_EXTERNAL_ID,++ ENABLE_USER,++ DISABLE_USER,+LIST_USERS,LIST_USER_NAMES,@@ -392,8 +400,12 @@ public interface AuditLog {REMOVE_GROUP,+ REMOVE_GROUP_BY_EXTERNAL_ID,+GET_GROUP,+ GET_GROUP_BY_EXTERNAL_ID,+LIST_GROUPS,LIST_GROUP_NAMES,diff --git a/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.java b/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.javaindex 1b75d267d0..53337d0a82 100644--- a/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.java+++ b/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.java@@ -120,14 +120,20 @@ public class CompatibilityUtils {.put(OperationType.ALTER_MODEL_VERSION, Operation.ALTER_MODEL_VERSION).put(OperationType.ADD_USER, Operation.ADD_USER).put(OperationType.REMOVE_USER, Operation.REMOVE_USER)+ .put(OperationType.REMOVE_USER_BY_EXTERNAL_ID, Operation.REMOVE_USER_BY_EXTERNAL_ID).put(OperationType.GET_USER, Operation.GET_USER)+ .put(OperationType.GET_USER_BY_EXTERNAL_ID, Operation.GET_USER_BY_EXTERNAL_ID)+ .put(OperationType.ENABLE_USER, Operation.ENABLE_USER)+ .put(OperationType.DISABLE_USER, Operation.DISABLE_USER).put(OperationType.LIST_USERS, Operation.LIST_USERS).put(OperationType.LIST_USER_NAMES, Operation.LIST_USER_NAMES).put(OperationType.GRANT_USER_ROLES, Operation.GRANT_USER_ROLES).put(OperationType.REVOKE_USER_ROLES, Operation.REVOKE_USER_ROLES).put(OperationType.ADD_GROUP, Operation.ADD_GROUP).put(OperationType.REMOVE_GROUP, Operation.REMOVE_GROUP)+ .put(OperationType.REMOVE_GROUP_BY_EXTERNAL_ID, Operation.REMOVE_GROUP_BY_EXTERNAL_ID).put(OperationType.GET_GROUP, Operation.GET_GROUP)+ .put(OperationType.GET_GROUP_BY_EXTERNAL_ID, Operation.GET_GROUP_BY_EXTERNAL_ID).put(OperationType.LIST_GROUPS, Operation.LIST_GROUPS).put(OperationType.LIST_GROUP_NAMES, Operation.LIST_GROUP_NAMES).put(OperationType.GRANT_GROUP_ROLES, Operation.GRANT_GROUP_ROLES)diff --git a/core/src/main/java/org/apache/gravitino/listener/AccessControlEventDispatcher.java b/core/src/main/java/org/apache/gravitino/listener/AccessControlEventDispatcher.javaindex e91819e3fd..9128e5f594 100644--- a/core/src/main/java/org/apache/gravitino/listener/AccessControlEventDispatcher.java+++ b/core/src/main/java/org/apache/gravitino/listener/AccessControlEventDispatcher.java@@ -50,12 +50,24 @@ import org.apache.gravitino.listener.api.event.CreateRolePreEvent;import org.apache.gravitino.listener.api.event.DeleteRoleEvent;import org.apache.gravitino.listener.api.event.DeleteRoleFailureEvent;import org.apache.gravitino.listener.api.event.DeleteRolePreEvent;+import org.apache.gravitino.listener.api.event.DisableUserEvent;+import org.apache.gravitino.listener.api.event.DisableUserFailureEvent;+import org.apache.gravitino.listener.api.event.DisableUserPreEvent;+import org.apache.gravitino.listener.api.event.EnableUserEvent;+import org.apache.gravitino.listener.api.event.EnableUserFailureEvent;+import org.apache.gravitino.listener.api.event.EnableUserPreEvent;+import org.apache.gravitino.listener.api.event.GetGroupByExternalIdEvent;+import org.apache.gravitino.listener.api.event.GetGroupByExternalIdFailureEvent;+import org.apache.gravitino.listener.api.event.GetGroupByExternalIdPreEvent;import org.apache.gravitino.listener.api.event.GetGroupEvent;import org.apache.gravitino.listener.api.event.GetGroupFailureEvent;import org.apache.gravitino.listener.api.event.GetGroupPreEvent;import org.apache.gravitino.listener.api.event.GetRoleEvent;import org.apache.gravitino.listener.api.event.GetRoleFailureEvent;import org.apache.gravitino.listener.api.event.GetRolePreEvent;+import org.apache.gravitino.listener.api.event.GetUserByExternalIdEvent;+import org.apache.gravitino.listener.api.event.GetUserByExternalIdFailureEvent;+import org.apache.gravitino.listener.api.event.GetUserByExternalIdPreEvent;import org.apache.gravitino.listener.api.event.GetUserEvent;import org.apache.gravitino.listener.api.event.GetUserFailureEvent;import org.apache.gravitino.listener.api.event.GetUserPreEvent;@@ -86,9 +98,15 @@ import org.apache.gravitino.listener.api.event.ListUsersPreEvent;import org.apache.gravitino.listener.api.event.OverridePrivilegesEvent;import org.apache.gravitino.listener.api.event.OverridePrivilegesFailureEvent;import org.apache.gravitino.listener.api.event.OverridePrivilegesPreEvent;+import org.apache.gravitino.listener.api.event.RemoveGroupByExternalIdEvent;+import org.apache.gravitino.listener.api.event.RemoveGroupByExternalIdFailureEvent;+import org.apache.gravitino.listener.api.event.RemoveGroupByExternalIdPreEvent;import org.apache.gravitino.listener.api.event.RemoveGroupEvent;import org.apache.gravitino.listener.api.event.RemoveGroupFailureEvent;import org.apache.gravitino.listener.api.event.RemoveGroupPreEvent;+import org.apache.gravitino.listener.api.event.RemoveUserByExternalIdEvent;+import org.apache.gravitino.listener.api.event.RemoveUserByExternalIdFailureEvent;+import org.apache.gravitino.listener.api.event.RemoveUserByExternalIdPreEvent;import org.apache.gravitino.listener.api.event.RemoveUserEvent;import org.apache.gravitino.listener.api.event.RemoveUserFailureEvent;import org.apache.gravitino.listener.api.event.RemoveUserPreEvent;@@ -149,7 +167,18 @@ public class AccessControlEventDispatcher implements AccessControlDispatcher {@Overridepublic User addUser(String metalake, String user, String externalId, boolean enabled)throws UserAlreadyExistsException, NoSuchMetalakeException {- return dispatcher.addUser(metalake, user, externalId, enabled);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new AddUserPreEvent(initiator, metalake, user));+ try {+ User userObject = dispatcher.addUser(metalake, user, externalId, enabled);+ eventBus.dispatchEvent(new AddUserEvent(initiator, metalake, new UserInfo(userObject)));++ return userObject;+ } catch (Exception e) {+ eventBus.dispatchEvent(new AddUserFailureEvent(initiator, metalake, e, user));+ throw e;+ }}/** {@inheritDoc} */@@ -173,7 +202,20 @@ public class AccessControlEventDispatcher implements AccessControlDispatcher {@Overridepublic boolean removeUserByExternalId(String metalake, String externalId)throws NoSuchMetalakeException {- return dispatcher.removeUserByExternalId(metalake, externalId);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new RemoveUserByExternalIdPreEvent(initiator, metalake, externalId));+ try {+ boolean isExists = dispatcher.removeUserByExternalId(metalake, externalId);+ eventBus.dispatchEvent(+ new RemoveUserByExternalIdEvent(initiator, metalake, externalId, isExists));++ return isExists;+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new RemoveUserByExternalIdFailureEvent(initiator, metalake, e, externalId));+ throw e;+ }}/** {@inheritDoc} */@@ -198,21 +240,56 @@ public class AccessControlEventDispatcher implements AccessControlDispatcher {@Overridepublic User getUserByExternalId(String metalake, String externalId)throws NoSuchUserException, NoSuchMetalakeException {- return dispatcher.getUserByExternalId(metalake, externalId);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new GetUserByExternalIdPreEvent(initiator, metalake, externalId));+ try {+ User userObject = dispatcher.getUserByExternalId(metalake, externalId);+ eventBus.dispatchEvent(+ new GetUserByExternalIdEvent(initiator, metalake, new UserInfo(userObject)));++ return userObject;+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new GetUserByExternalIdFailureEvent(initiator, metalake, e, externalId));+ throw e;+ }}/** {@inheritDoc} */@Overridepublic User enableUser(String metalake, String externalId)throws NoSuchUserException, NoSuchMetalakeException {- return dispatcher.enableUser(metalake, externalId);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new EnableUserPreEvent(initiator, metalake, externalId));+ try {+ User userObject = dispatcher.enableUser(metalake, externalId);+ eventBus.dispatchEvent(new EnableUserEvent(initiator, metalake, new UserInfo(userObject)));++ return userObject;+ } catch (Exception e) {+ eventBus.dispatchEvent(new EnableUserFailureEvent(initiator, metalake, e, externalId));+ throw e;+ }}/** {@inheritDoc} */@Overridepublic User disableUser(String metalake, String externalId)throws NoSuchUserException, NoSuchMetalakeException {- return dispatcher.disableUser(metalake, externalId);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new DisableUserPreEvent(initiator, metalake, externalId));+ try {+ User userObject = dispatcher.disableUser(metalake, externalId);+ eventBus.dispatchEvent(new DisableUserEvent(initiator, metalake, new UserInfo(userObject)));++ return userObject;+ } catch (Exception e) {+ eventBus.dispatchEvent(new DisableUserFailureEvent(initiator, metalake, e, externalId));+ throw e;+ }}/** {@inheritDoc} */@@ -273,7 +350,18 @@ public class AccessControlEventDispatcher implements AccessControlDispatcher {@Overridepublic Group addGroup(String metalake, String group, String externalId)throws GroupAlreadyExistsException, NoSuchMetalakeException {- return dispatcher.addGroup(metalake, group, externalId);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new AddGroupPreEvent(initiator, metalake, group));+ try {+ Group groupObject = dispatcher.addGroup(metalake, group, externalId);+ eventBus.dispatchEvent(new AddGroupEvent(initiator, metalake, new GroupInfo(groupObject)));++ return groupObject;+ } catch (Exception e) {+ eventBus.dispatchEvent(new AddGroupFailureEvent(initiator, metalake, e, group));+ throw e;+ }}/** {@inheritDoc} */@@ -297,7 +385,20 @@ public class AccessControlEventDispatcher implements AccessControlDispatcher {@Overridepublic boolean removeGroupByExternalId(String metalake, String externalId)throws NoSuchMetalakeException {- return dispatcher.removeGroupByExternalId(metalake, externalId);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new RemoveGroupByExternalIdPreEvent(initiator, metalake, externalId));+ try {+ boolean isExists = dispatcher.removeGroupByExternalId(metalake, externalId);+ eventBus.dispatchEvent(+ new RemoveGroupByExternalIdEvent(initiator, metalake, externalId, isExists));++ return isExists;+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new RemoveGroupByExternalIdFailureEvent(initiator, metalake, e, externalId));+ throw e;+ }}/** {@inheritDoc} */@@ -322,7 +423,20 @@ public class AccessControlEventDispatcher implements AccessControlDispatcher {@Overridepublic Group getGroupByExternalId(String metalake, String externalId)throws NoSuchGroupException, NoSuchMetalakeException {- return dispatcher.getGroupByExternalId(metalake, externalId);+ String initiator = PrincipalUtils.getCurrentUserName();++ eventBus.dispatchEvent(new GetGroupByExternalIdPreEvent(initiator, metalake, externalId));+ try {+ Group groupObject = dispatcher.getGroupByExternalId(metalake, externalId);+ eventBus.dispatchEvent(+ new GetGroupByExternalIdEvent(initiator, metalake, new GroupInfo(groupObject)));++ return groupObject;+ } catch (Exception e) {+ eventBus.dispatchEvent(+ new GetGroupByExternalIdFailureEvent(initiator, metalake, e, externalId));+ throw e;+ }}/** {@inheritDoc} */diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserEvent.javanew file mode 100644index 0000000000..e52e9420b7--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserEvent.java@@ -0,0 +1,65 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;+import org.apache.gravitino.listener.api.info.UserInfo;++/** Represents an event triggered after successfully disabling a user by external id. */+@DeveloperApi+public class DisableUserEvent extends UserEvent {+ private final UserInfo updatedUserInfo;++ /**+ * Creates a new {DisableUserEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param updatedUserInfo The updated user information.+ */+ public DisableUserEvent(String initiator, String metalake, UserInfo updatedUserInfo) {+ super(+ initiator,+ AuthorizationUtils.ofUserExternalId(+ metalake,+ updatedUserInfo+ .externalId()+ .orElseThrow(+ () ->+ new IllegalStateException(+ "User external id is required for DisableUserEvent"))));+ this.updatedUserInfo = updatedUserInfo;+ }++ /**+ * Returns the updated user information.+ *+ * @return The user information.+ */+ public UserInfo updatedUserInfo() {+ return updatedUserInfo;+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_USER;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserFailureEvent.javanew file mode 100644index 0000000000..ae6361ccf0--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserFailureEvent.java@@ -0,0 +1,57 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered when disabling a user by external id fails. */+@DeveloperApi+public class DisableUserFailureEvent extends UserFailureEvent {+ private final String externalId;++ /**+ * Creates a new {DisableUserFailureEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param exception The exception that caused the failure.+ * @param externalId The external identifier of the user.+ */+ public DisableUserFailureEvent(+ String initiator, String metalake, Exception exception, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId), exception);+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_USER;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserPreEvent.javanew file mode 100644index 0000000000..91a4458c4d--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/DisableUserPreEvent.java@@ -0,0 +1,55 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered before disabling a user by external id. */+@DeveloperApi+public class DisableUserPreEvent extends UserPreEvent {+ private final String externalId;++ /**+ * Creates a new {DisableUserPreEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param externalId The external identifier of the user.+ */+ public DisableUserPreEvent(String initiator, String metalake, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId));+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.DISABLE_USER;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserEvent.javanew file mode 100644index 0000000000..4f08221a23--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserEvent.java@@ -0,0 +1,65 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;+import org.apache.gravitino.listener.api.info.UserInfo;++/** Represents an event triggered after successfully enabling a user by external id. */+@DeveloperApi+public class EnableUserEvent extends UserEvent {+ private final UserInfo updatedUserInfo;++ /**+ * Creates a new {EnableUserEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param updatedUserInfo The updated user information.+ */+ public EnableUserEvent(String initiator, String metalake, UserInfo updatedUserInfo) {+ super(+ initiator,+ AuthorizationUtils.ofUserExternalId(+ metalake,+ updatedUserInfo+ .externalId()+ .orElseThrow(+ () ->+ new IllegalStateException(+ "User external id is required for EnableUserEvent"))));+ this.updatedUserInfo = updatedUserInfo;+ }++ /**+ * Returns the updated user information.+ *+ * @return The user information.+ */+ public UserInfo updatedUserInfo() {+ return updatedUserInfo;+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_USER;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserFailureEvent.javanew file mode 100644index 0000000000..08a2cab0a7--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserFailureEvent.java@@ -0,0 +1,57 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered when enabling a user by external id fails. */+@DeveloperApi+public class EnableUserFailureEvent extends UserFailureEvent {+ private final String externalId;++ /**+ * Creates a new {EnableUserFailureEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param exception The exception that caused the failure.+ * @param externalId The external identifier of the user.+ */+ public EnableUserFailureEvent(+ String initiator, String metalake, Exception exception, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId), exception);+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_USER;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserPreEvent.javanew file mode 100644index 0000000000..e89a76ee04--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/EnableUserPreEvent.java@@ -0,0 +1,55 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered before enabling a user by external id. */+@DeveloperApi+public class EnableUserPreEvent extends UserPreEvent {+ private final String externalId;++ /**+ * Creates a new {@link EnableUserPreEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param externalId The external identifier of the user.+ */+ public EnableUserPreEvent(String initiator, String metalake, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId));+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.ENABLE_USER;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdEvent.javanew file mode 100644index 0000000000..7a54d57207--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdEvent.java@@ -0,0 +1,54 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;+import org.apache.gravitino.listener.api.info.GroupInfo;++/** Represents an event triggered after successfully retrieving a group by external id. */+@DeveloperApi+public class GetGroupByExternalIdEvent extends GroupEvent {+ private final GroupInfo loadedGroupInfo;++ public GetGroupByExternalIdEvent(String initiator, String metalake, GroupInfo loadedGroupInfo) {+ super(+ initiator,+ AuthorizationUtils.ofGroupExternalId(+ metalake,+ loadedGroupInfo+ .externalId()+ .orElseThrow(+ () ->+ new IllegalStateException(+ "Group external id is required for GetGroupByExternalIdEvent"))));+ this.loadedGroupInfo = loadedGroupInfo;+ }++ /** Returns the retrieved group information. */+ public GroupInfo loadedGroupInfo() {+ return loadedGroupInfo;+ }++ @Override+ public OperationType operationType() {+ return OperationType.GET_GROUP_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdFailureEvent.javanew file mode 100644index 0000000000..38764265d9--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdFailureEvent.java@@ -0,0 +1,45 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered when retrieving a group by external id fails. */+@DeveloperApi+public class GetGroupByExternalIdFailureEvent extends GroupFailureEvent {+ private final String externalId;++ public GetGroupByExternalIdFailureEvent(+ String initiator, String metalake, Exception exception, String externalId) {+ super(initiator, AuthorizationUtils.ofGroupExternalId(metalake, externalId), exception);+ this.externalId = externalId;+ }++ /** Returns the external identifier of the group. */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.GET_GROUP_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdPreEvent.javanew file mode 100644index 0000000000..ba93d71f39--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/GetGroupByExternalIdPreEvent.java@@ -0,0 +1,44 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered before retrieving a group by external id. */+@DeveloperApi+public class GetGroupByExternalIdPreEvent extends GroupPreEvent {+ private final String externalId;++ public GetGroupByExternalIdPreEvent(String initiator, String metalake, String externalId) {+ super(initiator, AuthorizationUtils.ofGroupExternalId(metalake, externalId));+ this.externalId = externalId;+ }++ /** Returns the external identifier of the group being retrieved. */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.GET_GROUP_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdEvent.javanew file mode 100644index 0000000000..aa3b48fdd6--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdEvent.java@@ -0,0 +1,65 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;+import org.apache.gravitino.listener.api.info.UserInfo;++/** Represents an event triggered after successfully retrieving a user by external id. */+@DeveloperApi+public class GetUserByExternalIdEvent extends UserEvent {+ private final UserInfo loadedUserInfo;++ /**+ * Creates a new {@link GetUserByExternalIdEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param loadedUserInfo The retrieved user information.+ */+ public GetUserByExternalIdEvent(String initiator, String metalake, UserInfo loadedUserInfo) {+ super(+ initiator,+ AuthorizationUtils.ofUserExternalId(+ metalake,+ loadedUserInfo+ .externalId()+ .orElseThrow(+ () ->+ new IllegalStateException(+ "User external id is required for GetUserByExternalIdEvent"))));+ this.loadedUserInfo = loadedUserInfo;+ }++ /**+ * Returns the retrieved user information.+ *+ * @return The user information.+ */+ public UserInfo loadedUserInfo() {+ return loadedUserInfo;+ }++ @Override+ public OperationType operationType() {+ return OperationType.GET_USER_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdFailureEvent.javanew file mode 100644index 0000000000..9d374609e1--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdFailureEvent.java@@ -0,0 +1,57 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered when retrieving a user by external id fails. */+@DeveloperApi+public class GetUserByExternalIdFailureEvent extends UserFailureEvent {+ private final String externalId;++ /**+ * Creates a new {@link GetUserByExternalIdFailureEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param exception The exception that caused the failure.+ * @param externalId The external identifier of the user.+ */+ public GetUserByExternalIdFailureEvent(+ String initiator, String metalake, Exception exception, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId), exception);+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.GET_USER_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdPreEvent.javanew file mode 100644index 0000000000..73f75d71ee--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/GetUserByExternalIdPreEvent.java@@ -0,0 +1,55 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered before retrieving a user by external id. */+@DeveloperApi+public class GetUserByExternalIdPreEvent extends UserPreEvent {+ private final String externalId;++ /**+ * Creates a new {@link GetUserByExternalIdPreEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param externalId The external identifier of the user.+ */+ public GetUserByExternalIdPreEvent(String initiator, String metalake, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId));+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user being retrieved.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.GET_USER_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java b/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.javaindex d3293d2b86..2866195e4b 100644--- a/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java@@ -129,6 +129,10 @@ public enum OperationType {ADD_USER,REMOVE_USER,GET_USER,+ GET_USER_BY_EXTERNAL_ID,+ REMOVE_USER_BY_EXTERNAL_ID,+ ENABLE_USER,+ DISABLE_USER,LIST_USERS,LIST_USER_NAMES,GRANT_USER_ROLES,@@ -138,6 +142,8 @@ public enum OperationType {ADD_GROUP,REMOVE_GROUP,GET_GROUP,+ GET_GROUP_BY_EXTERNAL_ID,+ REMOVE_GROUP_BY_EXTERNAL_ID,LIST_GROUPS,LIST_GROUP_NAMES,GRANT_GROUP_ROLES,diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdEvent.javanew file mode 100644index 0000000000..57fb82b49a--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdEvent.java@@ -0,0 +1,52 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered after removing a group by external id. */+@DeveloperApi+public class RemoveGroupByExternalIdEvent extends GroupEvent {+ private final String externalId;+ private final boolean isExists;++ public RemoveGroupByExternalIdEvent(+ String initiator, String metalake, String externalId, boolean isExists) {+ super(initiator, AuthorizationUtils.ofGroupExternalId(metalake, externalId));+ this.externalId = externalId;+ this.isExists = isExists;+ }++ /** Returns the external identifier of the removed group. */+ public String externalId() {+ return externalId;+ }++ /** Returns whether the group existed and was removed. */+ public boolean isExists() {+ return isExists;+ }++ @Override+ public OperationType operationType() {+ return OperationType.REMOVE_GROUP_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdFailureEvent.javanew file mode 100644index 0000000000..5a13de0101--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdFailureEvent.java@@ -0,0 +1,45 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered when removing a group by external id fails. */+@DeveloperApi+public class RemoveGroupByExternalIdFailureEvent extends GroupFailureEvent {+ private final String externalId;++ public RemoveGroupByExternalIdFailureEvent(+ String initiator, String metalake, Exception exception, String externalId) {+ super(initiator, AuthorizationUtils.ofGroupExternalId(metalake, externalId), exception);+ this.externalId = externalId;+ }++ /** Returns the external identifier of the group. */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.REMOVE_GROUP_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdPreEvent.javanew file mode 100644index 0000000000..b0c3f897ff--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveGroupByExternalIdPreEvent.java@@ -0,0 +1,44 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered before removing a group by external id. */+@DeveloperApi+public class RemoveGroupByExternalIdPreEvent extends GroupPreEvent {+ private final String externalId;++ public RemoveGroupByExternalIdPreEvent(String initiator, String metalake, String externalId) {+ super(initiator, AuthorizationUtils.ofGroupExternalId(metalake, externalId));+ this.externalId = externalId;+ }++ /** Returns the external identifier of the group being removed. */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.REMOVE_GROUP_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdEvent.javanew file mode 100644index 0000000000..5bd7095615--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdEvent.java@@ -0,0 +1,68 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered after removing a user by external id. */+@DeveloperApi+public class RemoveUserByExternalIdEvent extends UserEvent {+ private final String externalId;+ private final boolean isExists;++ /**+ * Creates a new {@link RemoveUserByExternalIdEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param externalId The external identifier of the user.+ * @param isExists Whether the user existed and was removed.+ */+ public RemoveUserByExternalIdEvent(+ String initiator, String metalake, String externalId, boolean isExists) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId));+ this.externalId = externalId;+ this.isExists = isExists;+ }++ /**+ * Returns the external identifier of the removed user.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ /**+ * Returns whether the user existed and was removed.+ *+ * @return {@code true} if the user was removed.+ */+ public boolean isExists() {+ return isExists;+ }++ @Override+ public OperationType operationType() {+ return OperationType.REMOVE_USER_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdFailureEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdFailureEvent.javanew file mode 100644index 0000000000..89f0fccdef--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdFailureEvent.java@@ -0,0 +1,57 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered when removing a user by external id fails. */+@DeveloperApi+public class RemoveUserByExternalIdFailureEvent extends UserFailureEvent {+ private final String externalId;++ /**+ * Creates a new {@link RemoveUserByExternalIdFailureEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param exception The exception that caused the failure.+ * @param externalId The external identifier of the user.+ */+ public RemoveUserByExternalIdFailureEvent(+ String initiator, String metalake, Exception exception, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId), exception);+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.REMOVE_USER_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdPreEvent.java b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdPreEvent.javanew file mode 100644index 0000000000..9d908df42b--- /dev/null+++ b/core/src/main/java/org/apache/gravitino/listener/api/event/RemoveUserByExternalIdPreEvent.java@@ -0,0 +1,55 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one+ * or more contributor license agreements. See the NOTICE file+ * distributed with this work for additional information+ * regarding copyright ownership. The ASF licenses this file+ * to you under the Apache License, Version 2.0 (the+ * "License"); you may not use this file except in compliance+ * with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing,+ * software distributed under the License is distributed on an+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ * KIND, either express or implied. See the License for the+ * specific language governing permissions and limitations+ * under the License.+ */++package org.apache.gravitino.listener.api.event;++import org.apache.gravitino.annotation.DeveloperApi;+import org.apache.gravitino.authorization.AuthorizationUtils;++/** Represents an event triggered before removing a user by external id. */+@DeveloperApi+public class RemoveUserByExternalIdPreEvent extends UserPreEvent {+ private final String externalId;++ /**+ * Creates a new {@link RemoveUserByExternalIdPreEvent}.+ *+ * @param initiator The user who initiated the request.+ * @param metalake The metalake name.+ * @param externalId The external identifier of the user.+ */+ public RemoveUserByExternalIdPreEvent(String initiator, String metalake, String externalId) {+ super(initiator, AuthorizationUtils.ofUserExternalId(metalake, externalId));+ this.externalId = externalId;+ }++ /**+ * Returns the external identifier of the user being removed.+ *+ * @return The external identifier.+ */+ public String externalId() {+ return externalId;+ }++ @Override+ public OperationType operationType() {+ return OperationType.REMOVE_USER_BY_EXTERNAL_ID;+ }+}diff --git a/core/src/main/java/org/apache/gravitino/listener/api/info/GroupInfo.java b/core/src/main/java/org/apache/gravitino/listener/api/info/GroupInfo.javaindex a1479cc5ef..21c0cf4414 100644--- a/core/src/main/java/org/apache/gravitino/listener/api/info/GroupInfo.java+++ b/core/src/main/java/org/apache/gravitino/listener/api/info/GroupInfo.java@@ -20,6 +20,7 @@package org.apache.gravitino.listener.api.info;import java.util.List;+import java.util.Optional;import org.apache.gravitino.annotation.DeveloperApi;import org.apache.gravitino.authorization.Group;@@ -27,6 +28,7 @@ import org.apache.gravitino.authorization.Group;@DeveloperApipublic class GroupInfo {private final String name;+ private final Optional<String> externalId;private List<String> roles;/**@@ -36,6 +38,7 @@ public class GroupInfo {*/public GroupInfo(Group group) {this.name = group.name();+ this.externalId = Optional.ofNullable(group.externalId());this.roles = group.roles();}@@ -48,6 +51,15 @@ public class GroupInfo {return name;}+ /**+ * Returns the external identifier of the group.+ *+ * @return The external identifier of the group, or empty if not set.+ */+ public Optional<String> externalId() {+ return externalId;+ }+/*** Returns the roles of the roles.*diff --git a/core/src/main/java/org/apache/gravitino/listener/api/info/UserInfo.java b/core/src/main/java/org/apache/gravitino/listener/api/info/UserInfo.javaindex e881df3a64..295342dcfc 100644--- a/core/src/main/java/org/apache/gravitino/listener/api/info/UserInfo.java+++ b/core/src/main/java/org/apache/gravitino/listener/api/info/UserInfo.java@@ -20,6 +20,7 @@package org.apache.gravitino.listener.api.info;import java.util.List;+import java.util.Optional;import org.apache.gravitino.annotation.DeveloperApi;import org.apache.gravitino.authorization.User;@@ -27,6 +28,8 @@ import org.apache.gravitino.authorization.User;@DeveloperApipublic class UserInfo {private final String name;+ private final Optional<String> externalId;+ private final boolean enabled;private List<String> roles;/**@@ -36,6 +39,8 @@ public class UserInfo {*/public UserInfo(User user) {this.name = user.name();+ this.externalId = Optional.ofNullable(user.externalId());+ this.enabled = user.enabled();this.roles = user.roles();}@@ -48,6 +53,24 @@ public class UserInfo {return name;}+ /**+ * Returns the external identifier of the user.+ *+ * @return the external identifier of the user, or empty if not set+ */+ public Optional<String> externalId() {+ return externalId;+ }++ /**+ * Returns whether the user is enabled.+ *+ * @return whether the user is enabled+ */+ public boolean enabled() {+ return enabled;+ }+/*** Returns the roles of the user.*diff --git a/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.java b/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.javaindex cfc22861cf..bf0bf7d2e4 100644--- a/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.java+++ b/core/src/test/java/org/apache/gravitino/audit/v2/TestCompatibilityUtils.java@@ -125,14 +125,20 @@ public class TestCompatibilityUtils {{OperationType.ALTER_MODEL_VERSION, Operation.ALTER_MODEL_VERSION},{OperationType.ADD_USER, Operation.ADD_USER},{OperationType.REMOVE_USER, Operation.REMOVE_USER},+ {OperationType.REMOVE_USER_BY_EXTERNAL_ID, Operation.REMOVE_USER_BY_EXTERNAL_ID},{OperationType.GET_USER, Operation.GET_USER},+ {OperationType.GET_USER_BY_EXTERNAL_ID, Operation.GET_USER_BY_EXTERNAL_ID},+ {OperationType.ENABLE_USER, Operation.ENABLE_USER},+ {OperationType.DISABLE_USER, Operation.DISABLE_USER},{OperationType.LIST_USERS, Operation.LIST_USERS},{OperationType.LIST_USER_NAMES, Operation.LIST_USER_NAMES},{OperationType.GRANT_USER_ROLES, Operation.GRANT_USER_ROLES},{OperationType.REVOKE_USER_ROLES, Operation.REVOKE_USER_ROLES},{OperationType.ADD_GROUP, Operation.ADD_GROUP},{OperationType.REMOVE_GROUP, Operation.REMOVE_GROUP},+ {OperationType.REMOVE_GROUP_BY_EXTERNAL_ID, Operation.REMOVE_GROUP_BY_EXTERNAL_ID},{OperationType.GET_GROUP, Operation.GET_GROUP},+ {OperationType.GET_GROUP_BY_EXTERNAL_ID, Operation.GET_GROUP_BY_EXTERNAL_ID},{OperationType.LIST_GROUPS, Operation.LIST_GROUPS},{OperationType.LIST_GROUP_NAMES, Operation.LIST_GROUP_NAMES},{OperationType.GRANT_GROUP_ROLES, Operation.GRANT_GROUP_ROLES},diff --git a/core/src/test/java/org/apache/gravitino/listener/api/event/TestGroupEvent.java b/core/src/test/java/org/apache/gravitino/listener/api/event/TestGroupEvent.javaindex b69a0dcae9..58c869933e 100644--- a/core/src/test/java/org/apache/gravitino/listener/api/event/TestGroupEvent.java+++ b/core/src/test/java/org/apache/gravitino/listener/api/event/TestGroupEvent.java@@ -26,8 +26,10 @@ import com.google.common.collect.ImmutableList;import java.util.Collections;import java.util.List;import java.util.Map;+import java.util.Optional;import org.apache.gravitino.NameIdentifier;import org.apache.gravitino.authorization.AccessControlDispatcher;+import org.apache.gravitino.authorization.AuthorizationUtils;import org.apache.gravitino.authorization.Group;import org.apache.gravitino.exceptions.GravitinoRuntimeException;import org.apache.gravitino.exceptions.NoSuchGroupException;@@ -48,6 +50,7 @@ public class TestGroupEvent {private static final String METALAKE = "demo_metalake";private static final String INEXIST_METALAKE = "inexist_metalake";+ private static final String GROUP_EXT_ID = "ext-group-1";private AccessControlEventDispatcher dispatcher;private AccessControlEventDispatcher failureDispatcher;private DummyEventListener dummyEventListener;@@ -55,6 +58,7 @@ public class TestGroupEvent {private String otherGroupName;private String inExistGroupName;private Group group;+ private Group externalIdGroup;private Group otherGroup;private NameIdentifier identifier;private List<String> grantedRoles;@@ -66,6 +70,7 @@ public class TestGroupEvent {this.otherGroupName = "group_admin";this.inExistGroupName = "group_not_exist";this.group = getMockGroup(groupName, ImmutableList.of("test", "engineer"));+ this.externalIdGroup = getMockGroupWithExtId(groupName, GROUP_EXT_ID, group.roles());this.otherGroup = getMockGroup(otherGroupName, null);this.identifier = NameIdentifier.of(METALAKE);this.grantedRoles = ImmutableList.of("test", "engineer");@@ -534,6 +539,58 @@ public class TestGroupEvent {Assertions.assertEquals(revokedRoles, revokeGroupRolesFailureEvent.roles());}+ @Test+ void testAddGroupWithExternalIdEvent() {+ dispatcher.addGroup(METALAKE, groupName, GROUP_EXT_ID);++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(AddGroupPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.ADD_GROUP, preEvent.operationType());++ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(AddGroupEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.ADD_GROUP, event.operationType());+ }++ @Test+ void testGetGroupByExternalIdEvent() {+ dispatcher.getGroupByExternalId(METALAKE, GROUP_EXT_ID);++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(GetGroupByExternalIdPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(+ AuthorizationUtils.ofGroupExternalId(METALAKE, GROUP_EXT_ID), preEvent.identifier());++ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(GetGroupByExternalIdEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.GET_GROUP_BY_EXTERNAL_ID, event.operationType());+ }++ @Test+ void testRemoveGroupByExternalIdEvent() {+ dispatcher.removeGroupByExternalId(METALAKE, GROUP_EXT_ID);++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(RemoveGroupByExternalIdPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.REMOVE_GROUP_BY_EXTERNAL_ID, preEvent.operationType());++ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(RemoveGroupByExternalIdEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.REMOVE_GROUP_BY_EXTERNAL_ID, event.operationType());+ }++ @Test+ void testGetGroupByExternalIdFailureEvent() {+ Assertions.assertThrowsExactly(+ GravitinoRuntimeException.class,+ () -> failureDispatcher.getGroupByExternalId(METALAKE, GROUP_EXT_ID));++ dummyEventListener.popPreEvent();+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(GetGroupByExternalIdFailureEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.GET_GROUP_BY_EXTERNAL_ID, event.operationType());+ }+private Group getMockGroup(String name, List<String> roles) {Group mockGroup = mock(Group.class);when(mockGroup.name()).thenReturn(name);@@ -542,18 +599,30 @@ public class TestGroupEvent {return mockGroup;}+ private Group getMockGroupWithExtId(String name, String externalId, List<String> roles) {+ Group mockGroup = mock(Group.class);+ when(mockGroup.name()).thenReturn(name);+ when(mockGroup.externalId()).thenReturn(externalId);+ when(mockGroup.roles()).thenReturn(roles);++ return mockGroup;+ }+private AccessControlEventDispatcher mockGroupDispatcher() {AccessControlEventDispatcher dispatcher = mock(AccessControlEventDispatcher.class);when(dispatcher.addGroup(METALAKE, groupName)).thenReturn(group);when(dispatcher.addGroup(METALAKE, otherGroupName)).thenReturn(otherGroup);+ when(dispatcher.addGroup(METALAKE, groupName, GROUP_EXT_ID)).thenReturn(externalIdGroup);when(dispatcher.removeGroup(METALAKE, groupName)).thenReturn(true);when(dispatcher.removeGroup(METALAKE, inExistGroupName)).thenReturn(false);+ when(dispatcher.removeGroupByExternalId(METALAKE, GROUP_EXT_ID)).thenReturn(true);when(dispatcher.listGroups(METALAKE)).thenReturn(new Group[] {group, otherGroup});when(dispatcher.listGroupNames(METALAKE)).thenReturn(new String[] {groupName, otherGroupName});when(dispatcher.getGroup(METALAKE, groupName)).thenReturn(group);+ when(dispatcher.getGroupByExternalId(METALAKE, GROUP_EXT_ID)).thenReturn(externalIdGroup);when(dispatcher.getGroup(METALAKE, inExistGroupName)).thenThrow(new NoSuchGroupException("group not found"));when(dispatcher.getGroup(INEXIST_METALAKE, groupName))@@ -575,6 +644,7 @@ public class TestGroupEvent {private void validateGroup(GroupInfo groupInfo, Group group) {Assertions.assertEquals(group.name(), groupInfo.name());+ Assertions.assertEquals(Optional.ofNullable(group.externalId()), groupInfo.externalId());Assertions.assertEquals(group.roles(), groupInfo.roles());}}diff --git a/core/src/test/java/org/apache/gravitino/listener/api/event/TestUserEvent.java b/core/src/test/java/org/apache/gravitino/listener/api/event/TestUserEvent.javaindex c6574a140e..e9ea0639dd 100644--- a/core/src/test/java/org/apache/gravitino/listener/api/event/TestUserEvent.java+++ b/core/src/test/java/org/apache/gravitino/listener/api/event/TestUserEvent.java@@ -25,7 +25,9 @@ import static org.mockito.Mockito.when;import com.google.common.collect.ImmutableList;import java.util.Collections;import java.util.List;+import java.util.Optional;import org.apache.gravitino.NameIdentifier;+import org.apache.gravitino.authorization.AuthorizationUtils;import org.apache.gravitino.authorization.User;import org.apache.gravitino.exceptions.GravitinoRuntimeException;import org.apache.gravitino.exceptions.NoSuchMetalakeException;@@ -44,6 +46,7 @@ import org.junit.jupiter.api.TestInstance;public class TestUserEvent {private static final String METALAKE = "demo_metalake";private static final String INEXIST_METALAKE = "inexist_metalake";+ private static final String USER_EXT_ID = "ext-user-1";private AccessControlEventDispatcher dispatcher;private AccessControlEventDispatcher failureDispatcher;private DummyEventListener dummyEventListener;@@ -51,6 +54,7 @@ public class TestUserEvent {private String otherUserName;private String inExistUserName;private User user;+ private User externalIdUser;private User otherUser;private NameIdentifier identifier;private NameIdentifier otherIdentifier;@@ -64,6 +68,7 @@ public class TestUserEvent {this.otherUserName = "user_admin";this.inExistUserName = "user_not_exist";this.user = getMockUser(userName, ImmutableList.of("test", "engineer"));+ this.externalIdUser = getMockUserWithExtId(userName, USER_EXT_ID, true, user.roles());this.otherUser = getMockUser(otherUserName, null);this.identifier = NameIdentifierUtil.ofUser(METALAKE, userName);this.otherIdentifier = NameIdentifierUtil.ofUser(METALAKE, otherUserName);@@ -86,6 +91,7 @@ public class TestUserEvent {UserInfo info = new UserInfo(mockUser);Assertions.assertEquals("mock_user", info.name());+ Assertions.assertEquals(Optional.empty(), info.externalId());Assertions.assertEquals(ImmutableList.of("admin"), info.roles());}@@ -472,18 +478,87 @@ public class TestUserEvent {Assertions.assertEquals(revokedRoles, revokeUserRolesFailureEvent.roles());}+ @Test+ void testAddUserWithExternalIdEvent() {+ dispatcher.addUser(METALAKE, userName, USER_EXT_ID, true);++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(AddUserPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.ADD_USER, preEvent.operationType());++ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(AddUserEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.ADD_USER, event.operationType());+ }++ @Test+ void testGetUserByExternalIdEvent() {+ dispatcher.getUserByExternalId(METALAKE, USER_EXT_ID);++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(GetUserByExternalIdPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(+ AuthorizationUtils.ofUserExternalId(METALAKE, USER_EXT_ID), preEvent.identifier());++ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(GetUserByExternalIdEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.GET_USER_BY_EXTERNAL_ID, event.operationType());+ }++ @Test+ void testEnableUserEvent() {+ dispatcher.enableUser(METALAKE, USER_EXT_ID);++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(EnableUserPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.ENABLE_USER, preEvent.operationType());++ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(EnableUserEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.ENABLE_USER, event.operationType());+ }++ @Test+ void testRemoveUserByExternalIdEvent() {+ dispatcher.removeUserByExternalId(METALAKE, USER_EXT_ID);++ PreEvent preEvent = dummyEventListener.popPreEvent();+ Assertions.assertEquals(RemoveUserByExternalIdPreEvent.class, preEvent.getClass());+ Assertions.assertEquals(OperationType.REMOVE_USER_BY_EXTERNAL_ID, preEvent.operationType());++ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(RemoveUserByExternalIdEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.REMOVE_USER_BY_EXTERNAL_ID, event.operationType());+ }++ @Test+ void testGetUserByExternalIdFailureEvent() {+ Assertions.assertThrowsExactly(+ GravitinoRuntimeException.class,+ () -> failureDispatcher.getUserByExternalId(METALAKE, USER_EXT_ID));++ dummyEventListener.popPreEvent();+ Event event = dummyEventListener.popPostEvent();+ Assertions.assertEquals(GetUserByExternalIdFailureEvent.class, event.getClass());+ Assertions.assertEquals(OperationType.GET_USER_BY_EXTERNAL_ID, event.operationType());+ }+private AccessControlEventDispatcher mockUserDispatcher() {AccessControlEventDispatcher dispatcher = mock(AccessControlEventDispatcher.class);when(dispatcher.addUser(METALAKE, userName)).thenReturn(user);when(dispatcher.addUser(METALAKE, otherUserName)).thenReturn(otherUser);+ when(dispatcher.addUser(METALAKE, userName, USER_EXT_ID, true)).thenReturn(externalIdUser);when(dispatcher.removeUser(METALAKE, userName)).thenReturn(true);when(dispatcher.removeUser(METALAKE, inExistUserName)).thenReturn(false);+ when(dispatcher.removeUserByExternalId(METALAKE, USER_EXT_ID)).thenReturn(true);when(dispatcher.listUsers(METALAKE)).thenReturn(new User[] {user, otherUser});when(dispatcher.listUserNames(METALAKE)).thenReturn(new String[] {userName, otherUserName});when(dispatcher.getUser(METALAKE, userName)).thenReturn(user);+ when(dispatcher.getUserByExternalId(METALAKE, USER_EXT_ID)).thenReturn(externalIdUser);+ when(dispatcher.enableUser(METALAKE, USER_EXT_ID)).thenReturn(externalIdUser);when(dispatcher.getUser(METALAKE, inExistUserName)).thenThrow(new NoSuchUserException("user not found"));when(dispatcher.getUser(INEXIST_METALAKE, userName))@@ -511,8 +586,20 @@ public class TestUserEvent {return user;}+ private User getMockUserWithExtId(+ String name, String externalId, boolean enabled, List<String> roles) {+ User user = mock(User.class);+ when(user.name()).thenReturn(name);+ when(user.externalId()).thenReturn(externalId);+ when(user.enabled()).thenReturn(enabled);+ when(user.roles()).thenReturn(roles);++ return user;+ }+private void validateUserInfo(UserInfo userInfo, User expectedUser) {Assertions.assertEquals(userInfo.name(), expectedUser.name());+ Assertions.assertEquals(Optional.ofNullable(expectedUser.externalId()), userInfo.externalId());Assertions.assertEquals(userInfo.roles(), expectedUser.roles());}}diff --git a/docs/gravitino-server-config.md b/docs/gravitino-server-config.mdindex 38910df37c..14ba65d06a 100644--- a/docs/gravitino-server-config.md+++ b/docs/gravitino-server-config.md@@ -207,8 +207,8 @@ Gravitino triggers a pre-event before the operation, a post-event after the comp| Iceberg REST server view operation | `IcebergCreateViewEvent`, `IcebergReplaceViewEvent`, `IcebergDropViewEvent`, `IcebergLoadViewEvent`, `IcebergListViewEvent`, `IcebergViewExistsEvent`, `IcebergRenameViewEvent`, `IcebergCreateViewFailureEvent`, `IcebergReplaceViewFailureEvent`, `IcebergDropViewFailureEvent`, `IcebergLoadViewFailureEvent`, `IcebergListViewFailureEvent`, `IcebergViewExistsFailureEvent`, `IcebergRenameViewFailureEvent` | 0.8.0-incubating || tag operation | `ListTagsEvent`, `ListTagsInfoEvent`, `CreateTagEvent`, `GetTagEvent`, `AlterTagEvent`, `DeleteTagEvent`, `ListMetadataObjectsForTagEvent`, `ListTagsForMetadataObjectEvent`, `ListTagsInfoForMetadataObjectEvent`, `AssociateTagsForMetadataObjectEvent`, `GetTagForMetadataObjectEvent`, `ListTagsFailureEvent`, `ListTagInfoFailureEvent`, `CreateTagFailureEvent`, `GetTagFailureEvent`, `AlterTagFailureEvent`, `DeleteTagFailureEvent`, `ListMetadataObjectsForTagFailureEvent`, `ListTagsForMetadataObjectFailureEvent`, `ListTagsInfoForMetadataObjectFailureEvent`, `AssociateTagsForMetadataObjectFailureEvent`, `GetTagForMetadataObjectFailureEvent` | 0.9.0-incubating || model operation | `DeleteModelEvent`, `DeleteModelVersionEvent`, `GetModelEvent`, `GetModelVersionEvent`, `GetModelVersionUriEvent`, `LinkModelVersionEvent`, `ListModelEvent`, `ListModelVersionsEvent`, `ListModelVersionInfosEvent`, `RegisterAndLinkModelEvent`, `RegisterModelEvent`, `AlterModelEvent`, `AlterModelVersionEvent`, `DeleteModelFailureEvent`, `DeleteModelVersionFailureEvent`, `GetModelFailureEvent`, `GetModelVersionFailureEvent`, `GetModelVersionUriFailureEvent`, `LinkModelVersionFailureEvent`, `ListModelFailureEvent`, `ListModelVersionFailureEvent`, `ListModelVersionInfosFailureEvent`, `RegisterAndLinkModelFailureEvent`, `RegisterModelFailureEvent`, `AlterModelFailureEvent`, `AlterModelVersionFailureEvent` | 0.9.0-incubating |-| user operation | `AddUserEvent`, `GetUserEvent`, `ListUserNamesEvent`, `ListUsersEvent`, `RemoveUserEvent`, `GrantUserRolesEvent`, `RevokeUserRolesEvent`, `AddUserFailureEvent`, `GetUserFailureEvent`, `GrantUserRolesFailureEvent`, `ListUserNamesFailureEvent`, `ListUsersFailureEvent`, `RemoveUserFailureEvent`, `RevokeUserRolesFailureEvent` | 0.9.0-incubating |-| group operation | `AddGroupEvent`, `GetGroupEvent`, `ListGroupNamesEvent`, `ListGroupsEvent`, `RemoveGroupEvent`, `GrantGroupRolesEvent`, `RevokeGroupRolesEvent`, `AddGroupFailureEvent`, `GetGroupFailureEvent`, `GrantGroupRolesFailureEvent`, `ListGroupNamesFailureEvent`, `ListGroupsFailureEvent`, `RemoveGroupFailureEvent`, `RevokeGroupRolesFailureEvent` | 0.9.0-incubating |+| user operation | `AddUserEvent`, `RemoveUserEvent`, `RemoveUserByExternalIdEvent`, `GetUserEvent`, `GetUserByExternalIdEvent`, `EnableUserEvent`, `DisableUserEvent`, `ListUserNamesEvent`, `ListUsersEvent`, `GrantUserRolesEvent`, `RevokeUserRolesEvent`, `AddUserFailureEvent`, `RemoveUserFailureEvent`, `RemoveUserByExternalIdFailureEvent`, `GetUserFailureEvent`, `GetUserByExternalIdFailureEvent`, `EnableUserFailureEvent`, `DisableUserFailureEvent`, `GrantUserRolesFailureEvent`, `ListUserNamesFailureEvent`, `ListUsersFailureEvent`, `RevokeUserRolesFailureEvent` | 0.9.0-incubating |+| group operation | `AddGroupEvent`, `RemoveGroupEvent`, `RemoveGroupByExternalIdEvent`, `GetGroupEvent`, `GetGroupByExternalIdEvent`, `ListGroupNamesEvent`, `ListGroupsEvent`, `GrantGroupRolesEvent`, `RevokeGroupRolesEvent`, `AddGroupFailureEvent`, `RemoveGroupFailureEvent`, `RemoveGroupByExternalIdFailureEvent`, `GetGroupFailureEvent`, `GetGroupByExternalIdFailureEvent`, `GrantGroupRolesFailureEvent`, `ListGroupNamesFailureEvent`, `ListGroupsFailureEvent`, `RevokeGroupRolesFailureEvent` | 0.9.0-incubating || role operation | `CreateRoleEvent`, `DeleteRoleEvent`, `GetRoleEvent`, `GrantPrivilegesEvent`, `ListRoleNamesEvent`, `RevokePrivilegesEvent`, `OverridePrivilegesEvent`, `CreateRoleFailureEvent`, `DeleteRoleFailureEvent`, `GetRoleFailureEvent`, `GrantPrivilegesFailureEvent`, `ListRoleNamesFailureEvent`, `RevokePrivilegesFailureEvent`, `OverridePrivilegesFailureEvent` | 0.9.0-incubating || owner operation | `SetOwnerEvent`, `GetOwnerEvent`, `SetOwnerFailureEvent`, `GetOwnerFailureEvent` | 1.0.0 || Gravitino server job template operation | `RegisterJobTemplateEvent`, `GetJobTemplateEvent`, `ListJobTemplatesEvent`, `AlterJobTemplateEvent`, `DeleteJobTemplateEvent`, `RegisterJobTemplateFailureEvent`, `GetJobTemplateFailureEvent`, `ListJobTemplatesFailureEvent`, `AlterJobTemplateFailureEvent`, `DeleteJobTemplateFailureEvent` | 1.0.1 |@@ -232,8 +232,8 @@ Gravitino triggers a pre-event before the operation, a post-event after the comp| Gravitino server fileset operation | `CreateFilesetPreEvent`, `AlterFilesetPreEvent`, `DropFilesetPreEvent`, `LoadFilesetPreEvent`,`ListFilesetPreEvent`,`GetFileLocationPreEvent`, `ListFilesPreEvent` | 0.8.0-incubating || Gravitino server model operation | `DeleteModelPreEvent`, `DeleteModelVersionPreEvent`, `RegisterAndLinkModelPreEvent`, `GetModelPreEvent`, `GetModelVersionPreEvent`, `GetModelVersionUriPreEvent`, `LinkModelVersionPreEvent`, `ListModelPreEvent`, `ListModelVersionPreEvent`, `ListModelVersionInfosPreEvent`, `RegisterModelPreEvent`, `AlterModelPreEvent`, `AlterModelVersionPreEvent` | 0.9.0-incubating || Gravitino server tag operation | `ListTagsPreEvent`, `ListTagsInfoPreEvent`, `CreateTagPreEvent`, `GetTagPreEvent`, `AlterTagPreEvent`, `DeleteTagPreEvent`, `ListMetadataObjectsForTagPreEvent`, `ListTagsForMetadataObjectPreEvent`, `ListTagsInfoForMetadataObjectPreEvent`, `AssociateTagsForMetadataObjectPreEvent`, `GetTagForMetadataObjectPreEvent` | 0.9.0-incubating |-| Gravitino server user operation | `AddUserPreEvent`, `GetUserPreEvent`, `ListUserNamesPreEvent`, `ListUsersPreEvent`, `RemoveUserPreEvent`, `GrantUserRolesPreEvent`, `RevokeUserRolesPreEvent` | 0.9.0-incubating |-| Gravitino server group operation | `AddGroupPreEvent`, `GetGroupPreEvent`, `ListGroupNamesPreEvent`, `ListGroupsPreEvent`, `RemoveGroupPreEvent`, `GrantGroupRolesPreEvent`, `RevokeGroupRolesPreEvent` | 0.9.0-incubating |+| Gravitino server user operation | `AddUserPreEvent`, `RemoveUserPreEvent`, `RemoveUserByExternalIdPreEvent`, `GetUserPreEvent`, `GetUserByExternalIdPreEvent`, `EnableUserPreEvent`, `DisableUserPreEvent`, `ListUserNamesPreEvent`, `ListUsersPreEvent`, `GrantUserRolesPreEvent`, `RevokeUserRolesPreEvent` | 0.9.0-incubating |+| Gravitino server group operation | `AddGroupPreEvent`, `RemoveGroupPreEvent`, `RemoveGroupByExternalIdPreEvent`, `GetGroupPreEvent`, `GetGroupByExternalIdPreEvent`, `ListGroupNamesPreEvent`, `ListGroupsPreEvent`, `GrantGroupRolesPreEvent`, `RevokeGroupRolesPreEvent` | 0.9.0-incubating || Gravitino server role operation | `CreateRolePreEvent`, `DeleteRolePreEvent`, `GetRolePreEvent`, `GrantPrivilegesPreEvent`, `ListRoleNamesPreEvent`, `RevokePrivilegesPreEvent`, `OverridePrivilegesPreEvent` | 0.9.0-incubating || Gravitino server owner operation | `SetOwnerPreEvent`, `GetOwnerPreEvent` | 1.0.0 || Gravitino server job template operation | `RegisterJobTemplatePreEvent`, `GetJobTemplatePreEvent`, `ListJobTemplatesPreEvent`, `AlterJobTemplatePreEvent`, `DeleteJobTemplatePreEvent` | 1.0.1 |