Skip to content

Commit a2db1db

Browse files
committed
Remove username from getRolePrivileges()
and rename `memberRole` to `memberRoleName`
1 parent 944b026 commit a2db1db

File tree

2 files changed

+21
-25
lines changed

2 files changed

+21
-25
lines changed

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ default List<UserRole> getUsersForRole(String roleName) throws ExecutionExceptio
272272
* Grants a role to another role.
273273
*
274274
* @param roleName the role name
275-
* @param memberRole the member role name
275+
* @param memberRoleName the member role name
276276
* @param withAdminOption if true, the member role can grant the role to other roles
277277
* @throws IllegalArgumentException if the role does not exist or the member role does not exist
278278
* @throws ExecutionException if the operation fails
279279
*/
280-
default void grantRoleToRole(String roleName, String memberRole, boolean withAdminOption)
280+
default void grantRoleToRole(String roleName, String memberRoleName, boolean withAdminOption)
281281
throws ExecutionException {
282282
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
283283
}
@@ -286,53 +286,51 @@ default void grantRoleToRole(String roleName, String memberRole, boolean withAdm
286286
* Revokes a role from another role.
287287
*
288288
* @param roleName the role name
289-
* @param memberRole the member role name
289+
* @param memberRoleName the member role name
290290
* @throws IllegalArgumentException if the role does not exist or the member role does not exist
291291
* @throws ExecutionException if the operation fails
292292
*/
293-
default void revokeRoleFromRole(String roleName, String memberRole) throws ExecutionException {
293+
default void revokeRoleFromRole(String roleName, String memberRoleName)
294+
throws ExecutionException {
294295
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
295296
}
296297

297298
/**
298299
* Revokes admin option from a role for another role.
299300
*
300301
* @param roleName the role name
301-
* @param memberRole the member role name
302+
* @param memberRoleName the member role name
302303
* @throws IllegalArgumentException if the role does not exist or the member role does not exist
303304
* @throws ExecutionException if the operation fails
304305
*/
305-
default void revokeAdminOptionFromRole(String roleName, String memberRole)
306+
default void revokeAdminOptionFromRole(String roleName, String memberRoleName)
306307
throws ExecutionException {
307308
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
308309
}
309310

310311
/**
311-
* Retrieves privileges for the given username, role and namespace.
312+
* Retrieves privileges for the given role and namespace.
312313
*
313-
* @param username the username
314314
* @param roleName the role name
315315
* @param namespaceName the namespace name
316316
* @return a set of privileges for the given role and namespace
317317
* @throws ExecutionException if the operation fails
318318
*/
319-
default Set<Privilege> getRolePrivileges(String username, String roleName, String namespaceName)
319+
default Set<Privilege> getRolePrivileges(String roleName, String namespaceName)
320320
throws ExecutionException {
321321
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
322322
}
323323

324324
/**
325-
* Retrieves privileges for the given username, role, namespace, and table.
325+
* Retrieves privileges for the given role, namespace, and table.
326326
*
327-
* @param username the username
328327
* @param roleName the role name
329328
* @param namespaceName the namespace name
330329
* @param tableName the table name
331330
* @return a set of privileges for the given role, namespace, and table
332331
* @throws ExecutionException if the operation fails
333332
*/
334-
default Set<Privilege> getRolePrivileges(
335-
String username, String roleName, String namespaceName, String tableName)
333+
default Set<Privilege> getRolePrivileges(String roleName, String namespaceName, String tableName)
336334
throws ExecutionException {
337335
throw new UnsupportedOperationException(CoreError.AUTH_NOT_ENABLED.buildMessage());
338336
}

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -426,34 +426,32 @@ public List<UserRole> getUsersForRole(String roleName) throws ExecutionException
426426
}
427427

428428
@Override
429-
public void grantRoleToRole(String roleName, String memberRole, boolean withAdminOption)
429+
public void grantRoleToRole(String roleName, String memberRoleName, boolean withAdminOption)
430430
throws ExecutionException {
431-
distributedTransactionAdmin.grantRoleToRole(roleName, memberRole, withAdminOption);
431+
distributedTransactionAdmin.grantRoleToRole(roleName, memberRoleName, withAdminOption);
432432
}
433433

434434
@Override
435-
public void revokeRoleFromRole(String roleName, String memberRole) throws ExecutionException {
436-
distributedTransactionAdmin.revokeRoleFromRole(roleName, memberRole);
435+
public void revokeRoleFromRole(String roleName, String memberRoleName) throws ExecutionException {
436+
distributedTransactionAdmin.revokeRoleFromRole(roleName, memberRoleName);
437437
}
438438

439439
@Override
440-
public void revokeAdminOptionFromRole(String roleName, String memberRole)
440+
public void revokeAdminOptionFromRole(String roleName, String memberRoleName)
441441
throws ExecutionException {
442-
distributedTransactionAdmin.revokeAdminOptionFromRole(roleName, memberRole);
442+
distributedTransactionAdmin.revokeAdminOptionFromRole(roleName, memberRoleName);
443443
}
444444

445445
@Override
446-
public Set<Privilege> getRolePrivileges(String username, String roleName, String namespaceName)
446+
public Set<Privilege> getRolePrivileges(String roleName, String namespaceName)
447447
throws ExecutionException {
448-
return distributedTransactionAdmin.getRolePrivileges(username, roleName, namespaceName);
448+
return distributedTransactionAdmin.getRolePrivileges(roleName, namespaceName);
449449
}
450450

451451
@Override
452-
public Set<Privilege> getRolePrivileges(
453-
String username, String roleName, String namespaceName, String tableName)
452+
public Set<Privilege> getRolePrivileges(String roleName, String namespaceName, String tableName)
454453
throws ExecutionException {
455-
return distributedTransactionAdmin.getRolePrivileges(
456-
username, roleName, namespaceName, tableName);
454+
return distributedTransactionAdmin.getRolePrivileges(roleName, namespaceName, tableName);
457455
}
458456

459457
@Override

0 commit comments

Comments
 (0)