Skip to content

Commit

Permalink
[#5172]fix bug:Iceberg catalog audit user is not correct (#5208)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

Iceberg and JDBC catalog audit user is not correct

### Why are the changes needed?

Fix: #5172 

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

No need
  • Loading branch information
lsyulong authored Oct 23, 2024
1 parent 3f2456e commit 44a47d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import org.apache.gravitino.rel.indexes.Index;
import org.apache.gravitino.utils.IsolatedClassLoader;
import org.apache.gravitino.utils.MapUtils;
import org.apache.gravitino.utils.PrincipalUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -570,9 +571,8 @@ private TableChange[] replaceJdbcProperties(TableChange[] changes) {
.toArray(TableChange[]::new);
}

// TODO. We should figure out a better way to get the current user from servlet container.
private static String currentUser() {
return System.getProperty("user.name");
return PrincipalUtils.getCurrentUserName();
}

public void deregisterDriver(Driver driver) throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.apache.gravitino.rel.expressions.transforms.Transform;
import org.apache.gravitino.rel.indexes.Index;
import org.apache.gravitino.utils.MapUtils;
import org.apache.gravitino.utils.PrincipalUtils;
import org.apache.iceberg.catalog.TableIdentifier;
import org.apache.iceberg.exceptions.AlreadyExistsException;
import org.apache.iceberg.exceptions.NamespaceNotEmptyException;
Expand Down Expand Up @@ -587,8 +588,7 @@ public void testConnection(
}
}

// TODO. We should figure out a better way to get the current user from servlet container.
private static String currentUser() {
return System.getProperty("user.name");
return PrincipalUtils.getCurrentUserName();
}
}

0 comments on commit 44a47d0

Please sign in to comment.