Skip to content

Commit 42ad173

Browse files
author
mpv1989
committed
Add user permission api changes
1 parent 108c772 commit 42ad173

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/main/java/com/arangodb/ArangoDatabase.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,12 @@ public void grantAccess(final String user, final Permissions permissions) throws
234234
* Grants access to the database for user user. You need permission to the _system database in order to execute this
235235
* call.
236236
*
237-
* @deprecated use {@link #grantAccess(String, Permissions)} instead
238237
* @see <a href= "https://docs.arangodb.com/current/HTTP/UserManagement/index.html#grant-or-revoke-database-access">
239238
* API Documentation</a>
240239
* @param user
241240
* The name of the user
242241
* @throws ArangoDBException
243242
*/
244-
@Deprecated
245243
public void grantAccess(final String user) throws ArangoDBException {
246244
executor.execute(grantAccessRequest(user, Permissions.RW), Void.class);
247245
}
@@ -250,14 +248,12 @@ public void grantAccess(final String user) throws ArangoDBException {
250248
* Revokes access to the database dbname for user user. You need permission to the _system database in order to
251249
* execute this call.
252250
*
253-
* @deprecated use {@link #grantAccess(String, Permissions)} instead
254251
* @see <a href= "https://docs.arangodb.com/current/HTTP/UserManagement/index.html#grant-or-revoke-database-access">
255252
* API Documentation</a>
256253
* @param user
257254
* The name of the user
258255
* @throws ArangoDBException
259256
*/
260-
@Deprecated
261257
public void revokeAccess(final String user) throws ArangoDBException {
262258
executor.execute(grantAccessRequest(user, Permissions.NONE), Void.class);
263259
}

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,16 @@ public void getCollectionsExcludeSystem() {
303303
}
304304
}
305305

306+
@Test
307+
public void grantAccess() {
308+
try {
309+
arangoDB.createUser("user1", "1234", null);
310+
db.grantAccess("user1");
311+
} finally {
312+
arangoDB.deleteUser("user1");
313+
}
314+
}
315+
306316
@Test
307317
public void grantAccessRW() {
308318
try {
@@ -342,15 +352,15 @@ public void grantAccessUserNotFound() {
342352
public void revokeAccess() {
343353
try {
344354
arangoDB.createUser("user1", "1234", null);
345-
db.grantAccess("user1", Permissions.NONE);
355+
db.revokeAccess("user1");
346356
} finally {
347357
arangoDB.deleteUser("user1");
348358
}
349359
}
350360

351361
@Test(expected = ArangoDBException.class)
352362
public void revokeAccessUserNotFound() {
353-
db.grantAccess("user1", Permissions.NONE);
363+
db.revokeAccess("user1");
354364
}
355365

356366
@Test

0 commit comments

Comments
 (0)