Skip to content

Commit bdbca22

Browse files
committed
address comment
1 parent 2b07cef commit bdbca22

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

authorizations/authorization-common/src/main/java/org/apache/gravitino/authorization/common/RangerAuthorizationProperties.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
/** The properties for Ranger authorization plugin. */
2525
public class RangerAuthorizationProperties extends AuthorizationProperties {
26+
public static final String RANGER_PREFIX = "authorization.ranger";
27+
2628
/** Ranger admin web URIs */
2729
public static final String RANGER_ADMIN_URL = "authorization.ranger.admin.url";
2830

@@ -73,7 +75,7 @@ public RangerAuthorizationProperties(Map<String, String> properties) {
7375

7476
@Override
7577
public String getPropertiesPrefix() {
76-
return "authorization.ranger";
78+
return RANGER_PREFIX;
7779
}
7880

7981
@Override

authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public abstract class RangerAuthorizationPlugin
8484
protected RangerClientExtension rangerClient;
8585
protected RangerHelper rangerHelper;
8686
@VisibleForTesting public final String rangerAdminName;
87-
private final int prefixLength;
8887

8988
protected RangerAuthorizationPlugin(String metalake, Map<String, String> config) {
9089
this.metalake = metalake;
@@ -103,9 +102,6 @@ protected RangerAuthorizationPlugin(String metalake, Map<String, String> config)
103102
rangerServiceName = config.get(RangerAuthorizationProperties.RANGER_SERVICE_NAME);
104103
rangerClient = new RangerClientExtension(rangerUrl, authType, rangerAdminName, password);
105104

106-
// We should consider `.` to add 1
107-
prefixLength = rangerAuthorizationProperties.getPropertiesPrefix().length() + 1;
108-
109105
if (Boolean.parseBoolean(
110106
config.get(RangerAuthorizationProperties.RANGER_SERVICE_CREATE_IF_ABSENT))) {
111107
createRangerServiceIfNecessary(config, rangerServiceName);
@@ -1016,7 +1012,8 @@ protected String getConfValue(Map<String, String> conf, String key, String defau
10161012
protected abstract Map<String, String> getServiceConfigs(Map<String, String> config);
10171013

10181014
protected int getPrefixLength() {
1019-
return prefixLength;
1015+
// We should consider `.`. We need to add 1
1016+
return RangerAuthorizationProperties.RANGER_PREFIX.length() + 1;
10201017
}
10211018

10221019
@Override

0 commit comments

Comments
 (0)