Skip to content

Commit edf7bfa

Browse files
Backport to branch(3) : Add AuthAdmin.getRole(roleName) for RBAC (#3245)
Co-authored-by: Mitsunori Komatsu <komamitsu@gmail.com>
1 parent 449f253 commit edf7bfa

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
@@ -382,6 +382,11 @@ public void dropRole(String roleName) throws ExecutionException {
382382
distributedTransactionAdmin.dropRole(roleName);
383383
}
384384

385+
@Override
386+
public Optional<Role> getRole(String roleName) throws ExecutionException {
387+
return distributedTransactionAdmin.getRole(roleName);
388+
}
389+
385390
@Override
386391
public List<Role> getRoles() throws ExecutionException {
387392
return distributedTransactionAdmin.getRoles();

0 commit comments

Comments
 (0)