Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5993] refactor: Move the JdbcAuthorizationPlugin to authorization-common module #5994

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading