diff --git a/api/src/main/java/org/apache/gravitino/authorization/Privileges.java b/api/src/main/java/org/apache/gravitino/authorization/Privileges.java index e3e0dd5d4ca..f56905733f6 100644 --- a/api/src/main/java/org/apache/gravitino/authorization/Privileges.java +++ b/api/src/main/java/org/apache/gravitino/authorization/Privileges.java @@ -26,23 +26,23 @@ /** The helper class for {@link Privilege}. */ public class Privileges { - private static final Set supportedTableTypes = + private static final Set SUPPORTED_TABLE_TYPES = Sets.newHashSet( MetadataObject.Type.METALAKE, MetadataObject.Type.CATALOG, MetadataObject.Type.SCHEMA, MetadataObject.Type.TABLE); - private static final Set supportedTopicTypes = + private static final Set SUPPORTED_TOPIC_TYPES = Sets.newHashSet( MetadataObject.Type.METALAKE, MetadataObject.Type.CATALOG, MetadataObject.Type.SCHEMA, MetadataObject.Type.TOPIC); - private static final Set supportedSchemaTypes = + private static final Set SUPPORTED_SCHEMA_TYPES = Sets.newHashSet( MetadataObject.Type.METALAKE, MetadataObject.Type.CATALOG, MetadataObject.Type.SCHEMA); - private static final Set supportedFilesetTypes = + private static final Set SUPPORTED_FILESET_TYPES = Sets.newHashSet( MetadataObject.Type.METALAKE, MetadataObject.Type.CATALOG, @@ -322,7 +322,7 @@ public static UseSchema deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedSchemaTypes.contains(type); + return SUPPORTED_SCHEMA_TYPES.contains(type); } } @@ -376,7 +376,7 @@ public static CreateTable deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedSchemaTypes.contains(type); + return SUPPORTED_SCHEMA_TYPES.contains(type); } } @@ -403,7 +403,7 @@ public static SelectTable deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedTableTypes.contains(type); + return SUPPORTED_TABLE_TYPES.contains(type); } } @@ -430,7 +430,7 @@ public static ModifyTable deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedTableTypes.contains(type); + return SUPPORTED_TABLE_TYPES.contains(type); } } @@ -457,7 +457,7 @@ public static CreateFileset deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedSchemaTypes.contains(type); + return SUPPORTED_SCHEMA_TYPES.contains(type); } } @@ -484,7 +484,7 @@ public static ReadFileset deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedFilesetTypes.contains(type); + return SUPPORTED_FILESET_TYPES.contains(type); } } @@ -511,7 +511,7 @@ public static WriteFileset deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedFilesetTypes.contains(type); + return SUPPORTED_FILESET_TYPES.contains(type); } } @@ -538,7 +538,7 @@ public static CreateTopic deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedSchemaTypes.contains(type); + return SUPPORTED_SCHEMA_TYPES.contains(type); } } @@ -565,7 +565,7 @@ public static ConsumeTopic deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedTopicTypes.contains(type); + return SUPPORTED_TOPIC_TYPES.contains(type); } } @@ -592,7 +592,7 @@ public static ProduceTopic deny() { @Override public boolean canBindTo(MetadataObject.Type type) { - return supportedTopicTypes.contains(type); + return SUPPORTED_TOPIC_TYPES.contains(type); } } diff --git a/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java b/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java index 5e2dd7f3ea1..9d5016deb01 100644 --- a/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java +++ b/core/src/main/java/org/apache/gravitino/authorization/AuthorizationUtils.java @@ -54,13 +54,13 @@ public class AuthorizationUtils { static final String ROLE_DOES_NOT_EXIST_MSG = "Role %s does not exist in th metalake %s"; private static final Logger LOG = LoggerFactory.getLogger(AuthorizationUtils.class); private static final String METALAKE_DOES_NOT_EXIST_MSG = "Metalake %s does not exist"; - private static final Set filesetPrivileges = + private static final Set FILESET_PRIVILEGES = Sets.newHashSet( Privilege.Name.CREATE_FILESET, Privilege.Name.WRITE_FILESET, Privilege.Name.READ_FILESET); - private static final Set tablePrivileges = + private static final Set TABLE_PRIVILEGES = Sets.newHashSet( Privilege.Name.CREATE_TABLE, Privilege.Name.MODIFY_TABLE, Privilege.Name.SELECT_TABLE); - private static final Set topicPrivileges = + private static final Set TOPIC_PRIVILEGES = Sets.newHashSet( Privilege.Name.CREATE_TOPIC, Privilege.Name.PRODUCE_TOPIC, Privilege.Name.CONSUME_TOPIC); @@ -280,15 +280,15 @@ public static void checkPrivilege( NameIdentifier identifier = MetadataObjectUtil.toEntityIdent(metalake, object); NameIdentifier catalogIdent = NameIdentifierUtil.getCatalogIdentifier(identifier); try { - if (filesetPrivileges.contains(privilege.name())) { + if (FILESET_PRIVILEGES.contains(privilege.name())) { checkCatalogType(catalogIdent, Catalog.Type.FILESET, privilege); } - if (tablePrivileges.contains(privilege.name())) { + if (TABLE_PRIVILEGES.contains(privilege.name())) { checkCatalogType(catalogIdent, Catalog.Type.RELATIONAL, privilege); } - if (topicPrivileges.contains(privilege.name())) { + if (TOPIC_PRIVILEGES.contains(privilege.name())) { checkCatalogType(catalogIdent, Catalog.Type.MESSAGING, privilege); } } catch (NoSuchCatalogException ne) {