Skip to content

Commit c83547f

Browse files
feeblefakiejosh-wongbrfrn169
authored
Backport to branch(3.13) : Revise feature names in error messages (#2337)
Co-authored-by: Josh <[email protected]> Co-authored-by: Toshihiro Suzuki <[email protected]>
1 parent e7cf74d commit c83547f

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

core/src/main/java/com/scalar/db/api/AuthAdmin.java

+11-22
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public interface AuthAdmin {
2525
*/
2626
default void createUser(String username, @Nullable String password, UserOption... userOptions)
2727
throws ExecutionException {
28-
throw new UnsupportedOperationException(
29-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
28+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
3029
}
3130

3231
/**
@@ -42,8 +41,7 @@ default void createUser(String username, @Nullable String password, UserOption..
4241
*/
4342
default void alterUser(String username, @Nullable String password, UserOption... userOptions)
4443
throws ExecutionException {
45-
throw new UnsupportedOperationException(
46-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
44+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
4745
}
4846

4947
/**
@@ -54,8 +52,7 @@ default void alterUser(String username, @Nullable String password, UserOption...
5452
* @throws ExecutionException if the operation fails
5553
*/
5654
default void dropUser(String username) throws ExecutionException {
57-
throw new UnsupportedOperationException(
58-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
55+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
5956
}
6057

6158
/**
@@ -71,8 +68,7 @@ default void dropUser(String username) throws ExecutionException {
7168
default void grant(
7269
String username, String namespaceName, String tableName, Privilege... privileges)
7370
throws ExecutionException {
74-
throw new UnsupportedOperationException(
75-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
71+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
7672
}
7773

7874
/**
@@ -86,8 +82,7 @@ default void grant(
8682
*/
8783
default void grant(String username, String namespaceName, Privilege... privileges)
8884
throws ExecutionException {
89-
throw new UnsupportedOperationException(
90-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
85+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
9186
}
9287

9388
/**
@@ -103,8 +98,7 @@ default void grant(String username, String namespaceName, Privilege... privilege
10398
default void revoke(
10499
String username, String namespaceName, String tableName, Privilege... privileges)
105100
throws ExecutionException {
106-
throw new UnsupportedOperationException(
107-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
101+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
108102
}
109103

110104
/**
@@ -118,8 +112,7 @@ default void revoke(
118112
*/
119113
default void revoke(String username, String namespaceName, Privilege... privileges)
120114
throws ExecutionException {
121-
throw new UnsupportedOperationException(
122-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
115+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
123116
}
124117

125118
/**
@@ -130,8 +123,7 @@ default void revoke(String username, String namespaceName, Privilege... privileg
130123
* @throws ExecutionException if the operation fails
131124
*/
132125
default Optional<User> getUser(String username) throws ExecutionException {
133-
throw new UnsupportedOperationException(
134-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
126+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
135127
}
136128

137129
/**
@@ -141,8 +133,7 @@ default Optional<User> getUser(String username) throws ExecutionException {
141133
* @throws ExecutionException if the operation fails
142134
*/
143135
default List<User> getUsers() throws ExecutionException {
144-
throw new UnsupportedOperationException(
145-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
136+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
146137
}
147138

148139
/**
@@ -157,8 +148,7 @@ default List<User> getUsers() throws ExecutionException {
157148
*/
158149
default Set<Privilege> getPrivileges(String username, String namespaceName, String tableName)
159150
throws ExecutionException {
160-
throw new UnsupportedOperationException(
161-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
151+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
162152
}
163153

164154
/**
@@ -172,8 +162,7 @@ default Set<Privilege> getPrivileges(String username, String namespaceName, Stri
172162
*/
173163
default Set<Privilege> getPrivileges(String username, String namespaceName)
174164
throws ExecutionException {
175-
throw new UnsupportedOperationException(
176-
CoreError.NOT_SUPPORTED_IN_COMMUNITY_EDITION.buildMessage());
165+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
177166
}
178167

179168
interface User {

core/src/main/java/com/scalar/db/common/error/CoreError.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ public enum CoreError implements ScalarDbError {
115115
"The clustering key is not properly specified. Operation: %s",
116116
"",
117117
""),
118-
NOT_SUPPORTED_IN_COMMUNITY_EDITION(
118+
AUTH_NOT_ENABLED(
119119
Category.USER_ERROR,
120120
"0022",
121-
"This feature is not supported in the ScalarDB Community edition",
121+
"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",
122122
"",
123123
""),
124124
CONDITION_BUILD_ERROR_CONDITION_NOT_ALLOWED_FOR_PUT_IF(

0 commit comments

Comments
 (0)