This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new ebf3f665ce1 Remove useless PrivilegeType (#29602)
ebf3f665ce1 is described below

commit ebf3f665ce13009ffdfd75f7552cd65f666917a3
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Dec 30 12:39:51 2023 +0800

    Remove useless PrivilegeType (#29602)
---
 .../authority/model/PrivilegeType.java             | 107 ---------------------
 .../authority/checker/PrivilegeTypeMapper.java     | 106 --------------------
 2 files changed, 213 deletions(-)

diff --git 
a/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/model/PrivilegeType.java
 
b/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/model/PrivilegeType.java
deleted file mode 100644
index 84c193de66e..00000000000
--- 
a/kernel/authority/api/src/main/java/org/apache/shardingsphere/authority/model/PrivilegeType.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.shardingsphere.authority.model;
-
-/**
- * Privilege Type.
- */
-public enum PrivilegeType {
-    
-    SELECT,
-    INSERT,
-    UPDATE,
-    DELETE,
-    CREATE,
-    ALTER,
-    DROP,
-    GRANT,
-    INDEX,
-    REFERENCES,
-    LOCK_TABLES,
-    CREATE_VIEW,
-    SHOW_VIEW,
-    EXECUTE,
-    EVENT,
-    TRIGGER,
-    SUPER,
-    SHOW_DB,
-    RELOAD,
-    SHUTDOWN,
-    PROCESS,
-    FILE,
-    CREATE_TMP,
-    REPL_SLAVE,
-    REPL_CLIENT,
-    CREATE_PROC,
-    ALTER_PROC,
-    CREATE_USER,
-    CREATE_TABLESPACE,
-    CREATE_ROLE,
-    DROP_ROLE,
-    TRUNCATE,
-    USAGE,
-    CONNECT,
-    TEMPORARY,
-    CREATE_DATABASE,
-    INHERIT,
-    CAN_LOGIN,
-    CREATE_FUNCTION,
-    CREATE_TABLE,
-    BACKUP_DATABASE,
-    CREATE_DEFAULT,
-    BACKUP_LOG,
-    CREATE_RULE,
-    CREATE_SEQUENCE,
-    CREATE_TYPE,
-    CREATE_SESSION,
-    ALTER_SESSION,
-    CREATE_SYNONYM,
-    ADMINISTER_BULK_OPERATIONS,
-    ALTER_ANY_AVAILABILITY_GROUP,
-    ALTER_ANY_CONNECTION,
-    ALTER_ANY_CREDENTIAL,
-    ALTER_ANY_DATABASE,
-    ALTER_ANY_ENDPOINT,
-    ALTER_ANY_EVENT_NOTIFICATION,
-    ALTER_ANY_EVENT_SESSION,
-    ALTER_ANY_LINKED_SERVER,
-    ALTER_ANY_LOGIN,
-    ALTER_ANY_SERVER_AUDIT,
-    ALTER_ANY_SERVER_ROLE,
-    ALTER_RESOURCES,
-    ALTER_SERVER_STATE,
-    ALTER_SETTINGS,
-    ALTER_TRACE,
-    AUTHENTICATE_SERVER,
-    CONNECT_ANY_DATABASE,
-    CONNECT_SQL,
-    CONTROL_SERVER,
-    CREATE_ANY_DATABASE,
-    CREATE_AVAILABILITY_GROUP,
-    CREATE_DDL_EVENT_NOTIFICATION,
-    CREATE_ENDPOINT,
-    CREATE_SERVER_ROLE,
-    CREATE_TRACE_EVENT_NOTIFICATION,
-    EXTERNAL_ACCESS_ASSEMBLY,
-    IMPERSONATE_ANY_LOGIN,
-    SELECT_ALL_USER_SECURABLES,
-    UNSAFE_ASSEMBLY,
-    VIEW_ANY_DATABASE,
-    VIEW_ANY_DEFINITION,
-    VIEW_SERVER_STATE
-}
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/PrivilegeTypeMapper.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/PrivilegeTypeMapper.java
deleted file mode 100644
index 0f3971eeda6..00000000000
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/PrivilegeTypeMapper.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.shardingsphere.authority.checker;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.authority.model.PrivilegeType;
-import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterDatabaseStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.AlterTableStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateDatabaseStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateFunctionStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTableStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropDatabaseStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.TruncateStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DeleteStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.UpdateStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowDatabasesStatement;
-
-/**
- * Privilege type mapper.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class PrivilegeTypeMapper {
-    
-    /**
-     * Get privilege type.
-     * 
-     * @param sqlStatement SQL statement
-     * @return privilege type
-     */
-    public static PrivilegeType getPrivilegeType(final SQLStatement 
sqlStatement) {
-        if (sqlStatement instanceof MySQLShowDatabasesStatement) {
-            return PrivilegeType.SHOW_DB;
-        }
-        if (sqlStatement instanceof DMLStatement) {
-            return getDMLPrivilegeType(sqlStatement);
-        }
-        if (sqlStatement instanceof DDLStatement) {
-            return getDDLPrivilegeType(sqlStatement);
-        }
-        // TODO add more Privilege and SQL statement mapping
-        return null;
-    }
-    
-    private static PrivilegeType getDMLPrivilegeType(final SQLStatement 
sqlStatement) {
-        if (sqlStatement instanceof SelectStatement) {
-            return PrivilegeType.SELECT;
-        }
-        if (sqlStatement instanceof InsertStatement) {
-            return PrivilegeType.INSERT;
-        }
-        if (sqlStatement instanceof UpdateStatement) {
-            return PrivilegeType.UPDATE;
-        }
-        if (sqlStatement instanceof DeleteStatement) {
-            return PrivilegeType.DELETE;
-        }
-        return null;
-    }
-    
-    private static PrivilegeType getDDLPrivilegeType(final SQLStatement 
sqlStatement) {
-        if (sqlStatement instanceof AlterDatabaseStatement) {
-            return PrivilegeType.ALTER_ANY_DATABASE;
-        }
-        if (sqlStatement instanceof AlterTableStatement) {
-            return PrivilegeType.ALTER;
-        }
-        if (sqlStatement instanceof CreateDatabaseStatement) {
-            return PrivilegeType.CREATE_DATABASE;
-        }
-        if (sqlStatement instanceof CreateTableStatement) {
-            return PrivilegeType.CREATE_TABLE;
-        }
-        if (sqlStatement instanceof CreateFunctionStatement) {
-            return PrivilegeType.CREATE_FUNCTION;
-        }
-        if (sqlStatement instanceof DropTableStatement || sqlStatement 
instanceof DropDatabaseStatement) {
-            return PrivilegeType.DROP;
-        }
-        if (sqlStatement instanceof TruncateStatement) {
-            return PrivilegeType.TRUNCATE;
-        }
-        return null;
-    }
-}

Reply via email to