Skip to content

Commit

Permalink
Backport to branch(3.13) : Revise feature names in error messages (#2337
Browse files Browse the repository at this point in the history
)

Co-authored-by: Josh <[email protected]>
Co-authored-by: Toshihiro Suzuki <[email protected]>
  • Loading branch information
3 people authored Nov 14, 2024
1 parent e7cf74d commit c83547f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
33 changes: 11 additions & 22 deletions core/src/main/java/com/scalar/db/api/AuthAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public interface AuthAdmin {
*/
default void createUser(String username, @Nullable String password, UserOption... userOptions)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -42,8 +41,7 @@ default void createUser(String username, @Nullable String password, UserOption..
*/
default void alterUser(String username, @Nullable String password, UserOption... userOptions)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -54,8 +52,7 @@ default void alterUser(String username, @Nullable String password, UserOption...
* @throws ExecutionException if the operation fails
*/
default void dropUser(String username) throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -71,8 +68,7 @@ default void dropUser(String username) throws ExecutionException {
default void grant(
String username, String namespaceName, String tableName, Privilege... privileges)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -86,8 +82,7 @@ default void grant(
*/
default void grant(String username, String namespaceName, Privilege... privileges)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -103,8 +98,7 @@ default void grant(String username, String namespaceName, Privilege... privilege
default void revoke(
String username, String namespaceName, String tableName, Privilege... privileges)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -118,8 +112,7 @@ default void revoke(
*/
default void revoke(String username, String namespaceName, Privilege... privileges)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -130,8 +123,7 @@ default void revoke(String username, String namespaceName, Privilege... privileg
* @throws ExecutionException if the operation fails
*/
default Optional<User> getUser(String username) throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -141,8 +133,7 @@ default Optional<User> getUser(String username) throws ExecutionException {
* @throws ExecutionException if the operation fails
*/
default List<User> getUsers() throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -157,8 +148,7 @@ default List<User> getUsers() throws ExecutionException {
*/
default Set<Privilege> getPrivileges(String username, String namespaceName, String tableName)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

/**
Expand All @@ -172,8 +162,7 @@ default Set<Privilege> getPrivileges(String username, String namespaceName, Stri
*/
default Set<Privilege> getPrivileges(String username, String namespaceName)
throws ExecutionException {
throw new UnsupportedOperationException(
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
}

interface User {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/com/scalar/db/common/error/CoreError.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public enum CoreError implements ScalarDbError {
"The clustering key is not properly specified. Operation: %s",
"",
""),
NOT_SUPPORTED_IN_COMMUNITY_EDITION(
AUTH_NOT_ENABLED(
Category.USER_ERROR,
"0022",
"This feature is not supported in the ScalarDB Community edition",
"The authentication and authorization feature is not enabled. To use this feature, you must enable it. Note that this feature is supported only in the ScalarDB Enterprise edition",
"",
""),
CONDITION_BUILD_ERROR_CONDITION_NOT_ALLOWED_FOR_PUT_IF(
Expand Down

0 comments on commit c83547f

Please sign in to comment.