Skip to content

Commit f017785

Browse files
Add AuthAdmin.getRole(roleName) for RBAC (#3238)
Co-authored-by: Hiroyuki Yamada <[email protected]>
1 parent 4318570 commit f017785

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,17 @@ default void dropRole(String roleName) throws ExecutionException {
197197
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
198198
}
199199

200+
/**
201+
* Retrieves a {@link Role}.
202+
*
203+
* @param roleName the role name
204+
* @return a {@link Role} for the given role name
205+
* @throws ExecutionException if the operation fails
206+
*/
207+
default Optional<Role> getRole(String roleName) throws ExecutionException {
208+
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
209+
}
210+
200211
/**
201212
* Retrieves a list of {@link Role}s.
202213
*

core/src/main/java/com/scalar/db/common/DecoratedDistributedTransactionAdmin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,11 @@ public void dropRole(String roleName) throws ExecutionException {
393393
distributedTransactionAdmin.dropRole(roleName);
394394
}
395395

396+
@Override
397+
public Optional<Role> getRole(String roleName) throws ExecutionException {
398+
return distributedTransactionAdmin.getRole(roleName);
399+
}
400+
396401
@Override
397402
public List<Role> getRoles() throws ExecutionException {
398403
return distributedTransactionAdmin.getRoles();

0 commit comments

Comments
 (0)