Skip to content

Commit 966caa3

Browse files
author
mpv1989
committed
Add user permission api changes
1 parent fddafcf commit 966caa3

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/main/java/com/arangodb/ArangoDatabaseAsync.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,12 @@ public CompletableFuture<Void> grantAccess(final String user, final Permissions
229229
* Grants access to the database dbname for user user. You need permission to the _system database in order to
230230
* execute this call.
231231
*
232-
* @deprecated use {@link #grantAccess(String, Permissions)} instead
233232
* @see <a href= "https://docs.arangodb.com/current/HTTP/UserManagement/index.html#grant-or-revoke-database-access">
234233
* API Documentation</a>
235234
* @param user
236235
* The name of the user
237236
* @return void
238237
*/
239-
@Deprecated
240238
public CompletableFuture<Void> grantAccess(final String user) {
241239
return executor.execute(grantAccessRequest(user, Permissions.RW), Void.class);
242240
}
@@ -245,14 +243,12 @@ public CompletableFuture<Void> grantAccess(final String user) {
245243
* Revokes access to the database dbname for user user. You need permission to the _system database in order to
246244
* execute this call.
247245
*
248-
* @deprecated use {@link #grantAccess(String, Permissions)} instead
249246
* @see <a href= "https://docs.arangodb.com/current/HTTP/UserManagement/index.html#grant-or-revoke-database-access">
250247
* API Documentation</a>
251248
* @param user
252249
* The name of the user
253250
* @return void
254251
*/
255-
@Deprecated
256252
public CompletableFuture<Void> revokeAccess(final String user) {
257253
return executor.execute(grantAccessRequest(user, Permissions.NONE), Void.class);
258254
}

src/test/java/com/arangodb/ArangoDatabaseTest.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,16 @@ public void getCollectionsExcludeSystem() throws InterruptedException, Execution
324324
}
325325
}
326326

327+
@Test
328+
public void grantAccess() throws InterruptedException, ExecutionException {
329+
try {
330+
arangoDB.createUser("user1", "1234", null).get();
331+
db.grantAccess("user1").get();
332+
} finally {
333+
arangoDB.deleteUser("user1").get();
334+
}
335+
}
336+
327337
@Test
328338
public void grantAccessRW() throws InterruptedException, ExecutionException {
329339
try {
@@ -363,15 +373,15 @@ public void grantAccessUserNotFound() throws InterruptedException, ExecutionExce
363373
public void revokeAccess() throws InterruptedException, ExecutionException {
364374
try {
365375
arangoDB.createUser("user1", "1234", null).get();
366-
db.grantAccess("user1", Permissions.NONE).get();
376+
db.revokeAccess("user1").get();
367377
} finally {
368378
arangoDB.deleteUser("user1").get();
369379
}
370380
}
371381

372382
@Test(expected = ExecutionException.class)
373383
public void revokeAccessUserNotFound() throws InterruptedException, ExecutionException {
374-
db.grantAccess("user1", Permissions.NONE).get();
384+
db.revokeAccess("user1").get();
375385
}
376386

377387
@Test

0 commit comments

Comments
 (0)