Skip to content

Commit

Permalink
[#5993] refactor: Move the JdbcAuthorizationPlugin to authorization-c…
Browse files Browse the repository at this point in the history
…ommon module (#5994)

### What changes were proposed in this pull request?

 Move the JdbcAuthorizationPlugin to authorization-common module

### Why are the changes needed?


Fix: #5993

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

No.

### How was this patch tested?
Just refactor.
  • Loading branch information
jerqi authored Dec 26, 2024
1 parent a68e5e2 commit 061f24b
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 106 deletions.
1 change: 1 addition & 0 deletions authorizations/authorization-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
}
implementation(libs.bundles.log4j)
implementation(libs.commons.lang3)
implementation(libs.commons.dbcp2)
implementation(libs.guava)
implementation(libs.javax.jaxb.api) {
exclude("*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public AuthorizationProperties(Map<String, String> properties) {
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}

abstract String getPropertiesPrefix();
public abstract String getPropertiesPrefix();

abstract void validate();
public abstract void validate();

public static void validate(String type, Map<String, String> properties) {
switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.apache.gravitino.authorization.RoleChange;
import org.apache.gravitino.authorization.SecurableObject;
import org.apache.gravitino.authorization.User;
import org.apache.gravitino.authorization.common.JdbcAuthorizationProperties;
import org.apache.gravitino.connector.authorization.AuthorizationPlugin;
import org.apache.gravitino.exceptions.AuthorizationPluginException;
import org.apache.gravitino.meta.AuditInfo;
Expand All @@ -55,7 +54,7 @@
* JDBC-based authorization plugins can inherit this class and implement their own SQL statements.
*/
@Unstable
abstract class JdbcAuthorizationPlugin implements AuthorizationPlugin, JdbcAuthorizationSQL {
public abstract class JdbcAuthorizationPlugin implements AuthorizationPlugin, JdbcAuthorizationSQL {

private static final String GROUP_PREFIX = "GRAVITINO_GROUP_";
private static final Logger LOG = LoggerFactory.getLogger(JdbcAuthorizationPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.gravitino.authorization.common;
package org.apache.gravitino.authorization.jdbc;

import java.util.Map;
import org.apache.gravitino.authorization.common.AuthorizationProperties;

/** The properties for JDBC authorization plugin. */
public class JdbcAuthorizationProperties extends AuthorizationProperties {
Expand All @@ -39,7 +40,7 @@ private void check(String key, String errorMsg) {
}

@Override
String getPropertiesPrefix() {
public String getPropertiesPrefix() {
return CONFIG_PREFIX;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/** Interface for SQL operations of the underlying access control system. */
@Unstable
interface JdbcAuthorizationSQL {
public interface JdbcAuthorizationSQL {

/**
* Get SQL statements for creating a user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@
import org.apache.gravitino.authorization.SecurableObject;
import org.apache.gravitino.authorization.SecurableObjects;
import org.apache.gravitino.authorization.User;
import org.apache.gravitino.authorization.common.JdbcAuthorizationProperties;
import org.apache.gravitino.meta.AuditInfo;
import org.apache.gravitino.meta.GroupEntity;
import org.apache.gravitino.meta.RoleEntity;
import org.apache.gravitino.meta.UserEntity;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class JdbcAuthorizationPluginTest {
public class TestJdbcAuthorizationPlugin {
private static List<String> expectSQLs = Lists.newArrayList();
private static List<MetadataObject.Type> expectTypes = Lists.newArrayList();
private static List<String> expectObjectNames = Lists.newArrayList();
Expand Down
96 changes: 0 additions & 96 deletions authorizations/authorization-jdbc/build.gradle.kts

This file was deleted.

2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if (gradle.startParameter.projectProperties["enableFuse"]?.toBoolean() == true)
}
include("iceberg:iceberg-common")
include("iceberg:iceberg-rest-server")
include("authorizations:authorization-ranger", "authorizations:authorization-jdbc", "authorizations:authorization-common", "authorizations:authorization-chain")
include("authorizations:authorization-ranger", "authorizations:authorization-common", "authorizations:authorization-chain")
include("trino-connector:trino-connector", "trino-connector:integration-test")
include("spark-connector:spark-common")
// kyuubi hive connector doesn't support 2.13 for Spark3.3
Expand Down

0 comments on commit 061f24b

Please sign in to comment.