diff --git a/ChangeLog b/ChangeLog
index 8b1a59d..8f07373 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+v4.2.3 (2017-07-31)
+---------------------------
+* added ArangoDatabaseAsync.getPermissions(String)
+* added ArangoCollectionAsync.getPermissions(String)
+* added ArangoDBAsync.grantDefaultDatabaseAccess(String, Permissions)
+* added ArangoDBAsync.grantDefaultCollectionAccess(String, Permissions)
+* added ArangoDatabaseAsync.grantDefaultCollectionAccess(String, Permissions)
+* fixed DateUtil (thread-safe)
+
v4.2.2 (2017-07-20)
---------------------------
* added ArangoDatabaseAsync.grantAccess(String, Permissions)
diff --git a/pom.xml b/pom.xml
index 734526b..5165d65 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.arangodb
arangodb-java-driver-async
- 4.2.3-SNAPSHOT
+ 4.2.3
2016
jar
diff --git a/src/main/java/com/arangodb/ArangoCollectionAsync.java b/src/main/java/com/arangodb/ArangoCollectionAsync.java
index c3c6b9e..828a110 100644
--- a/src/main/java/com/arangodb/ArangoCollectionAsync.java
+++ b/src/main/java/com/arangodb/ArangoCollectionAsync.java
@@ -837,10 +837,24 @@ public CompletableFuture revokeAccess(final String user) {
* Documentation
* @param user
* The name of the user
+ * @since ArangoDB 3.2.0
* @return void
*/
public CompletableFuture resetAccess(final String user) {
return executor.execute(resetAccessRequest(user), Void.class);
}
+ /**
+ * Get the collection access level
+ *
+ * @see
+ * API Documentation
+ * @param user
+ * The name of the user
+ * @return permissions of the user
+ * @since ArangoDB 3.2.0
+ */
+ public CompletableFuture getPermissions(final String user) throws ArangoDBException {
+ return executor.execute(getPermissionsRequest(user), getPermissionsResponseDeserialzer());
+ }
}
diff --git a/src/main/java/com/arangodb/ArangoDBAsync.java b/src/main/java/com/arangodb/ArangoDBAsync.java
index ddd55f6..9e531ca 100644
--- a/src/main/java/com/arangodb/ArangoDBAsync.java
+++ b/src/main/java/com/arangodb/ArangoDBAsync.java
@@ -576,14 +576,68 @@ public CompletableFuture replaceUser(final String user, final UserUp
return executor.execute(replaceUserRequest(db().name(), user, options), UserEntity.class);
}
+ /**
+ * @deprecated use {@link #grantDefaultDatabaseAccess(String, Permissions)} instead
+ *
+ * @param user
+ * The name of the user
+ * @param permissions
+ * The permissions the user grant
+ * @since ArangoDB 3.2.0
+ * @return void
+ */
+ @Deprecated
public CompletableFuture updateUserDefaultDatabaseAccess(final String user, final Permissions permissions) {
return executor.execute(updateUserDefaultDatabaseAccessRequest(user, permissions), Void.class);
}
+ /**
+ * Sets the default access level for databases for the user user
. You need permission to the _system
+ * database in order to execute this call.
+ *
+ * @param user
+ * The name of the user
+ * @param permissions
+ * The permissions the user grant
+ * @since ArangoDB 3.2.0
+ * @return void
+ */
+ public CompletableFuture grantDefaultDatabaseAccess(final String user, final Permissions permissions)
+ throws ArangoDBException {
+ return executor.execute(updateUserDefaultDatabaseAccessRequest(user, permissions), Void.class);
+ }
+
+ /**
+ * @deprecated user {@link #grantDefaultCollectionAccess(String, Permissions)} instead
+ *
+ * @param user
+ * The name of the user
+ * @param permissions
+ * The permissions the user grant
+ * @since ArangoDB 3.2.0
+ * @return void
+ */
+ @Deprecated
public CompletableFuture updateUserDefaultCollectionAccess(final String user, final Permissions permissions) {
return executor.execute(updateUserDefaultCollectionAccessRequest(user, permissions), Void.class);
}
+ /**
+ * Sets the default access level for collections for the user user
. You need permission to the _system
+ * database in order to execute this call.
+ *
+ * @param user
+ * The name of the user
+ * @param permissions
+ * The permissions the user grant
+ * @since ArangoDB 3.2.0
+ * @return void
+ */
+ public CompletableFuture grantDefaultCollectionAccess(final String user, final Permissions permissions)
+ throws ArangoDBException {
+ return executor.execute(updateUserDefaultCollectionAccessRequest(user, permissions), Void.class);
+ }
+
/**
* Generic Execute. Use this method to execute custom FOXX services.
*
diff --git a/src/main/java/com/arangodb/ArangoDatabaseAsync.java b/src/main/java/com/arangodb/ArangoDatabaseAsync.java
index d494b2c..99411df 100644
--- a/src/main/java/com/arangodb/ArangoDatabaseAsync.java
+++ b/src/main/java/com/arangodb/ArangoDatabaseAsync.java
@@ -260,16 +260,56 @@ public CompletableFuture revokeAccess(final String user) {
* API Documentation
* @param user
* The name of the user
+ * @since ArangoDB 3.2.0
* @return void
*/
public CompletableFuture resetAccess(final String user) {
return executor.execute(resetAccessRequest(user), Void.class);
}
+ /**
+ * Sets the default access level for collections within this database for the user user
. You need
+ * permission to the _system database in order to execute this call.
+ *
+ * @param user
+ * The name of the user
+ * @param permissions
+ * The permissions the user grant
+ * @since ArangoDB 3.2.0
+ * @throws ArangoDBException
+ */
+ public CompletableFuture grantDefaultCollectionAccess(final String user, final Permissions permissions)
+ throws ArangoDBException {
+ return executor.execute(updateUserDefaultCollectionAccessRequest(user, permissions), Void.class);
+ }
+
+ /**
+ * @deprecated use {@link #grantDefaultCollectionAccess(String, Permissions)} instead
+ * @param user
+ * The name of the user
+ * @param permissions
+ * The permissions the user grant
+ * @since ArangoDB 3.2.0
+ */
+ @Deprecated
public CompletableFuture updateUserDefaultCollectionAccess(final String user, final Permissions permissions) {
return executor.execute(updateUserDefaultCollectionAccessRequest(user, permissions), Void.class);
}
+ /**
+ * Get specific database access level
+ *
+ * @see API
+ * Documentation
+ * @param user
+ * The name of the user
+ * @return permissions of the user
+ * @since ArangoDB 3.2.0
+ */
+ public CompletableFuture getPermissions(final String user) throws ArangoDBException {
+ return executor.execute(getPermissionsRequest(user), getPermissionsResponseDeserialzer());
+ }
+
/**
* Create a cursor and return the first results
*
diff --git a/src/test/java/com/arangodb/ArangoCollectionTest.java b/src/test/java/com/arangodb/ArangoCollectionTest.java
index 2ff5cce..4f3ae5f 100644
--- a/src/test/java/com/arangodb/ArangoCollectionTest.java
+++ b/src/test/java/com/arangodb/ArangoCollectionTest.java
@@ -2112,4 +2112,8 @@ public void resetAccessUserNotFound() throws InterruptedException, ExecutionExce
db.collection(COLLECTION_NAME).resetAccess("user1").get();
}
+ @Test
+ public void getPermissions() throws ArangoDBException, InterruptedException, ExecutionException {
+ assertThat(Permissions.RW, is(db.collection(COLLECTION_NAME).getPermissions("root").get()));
+ }
}
diff --git a/src/test/java/com/arangodb/ArangoDBTest.java b/src/test/java/com/arangodb/ArangoDBTest.java
index 2f9f581..4577050 100644
--- a/src/test/java/com/arangodb/ArangoDBTest.java
+++ b/src/test/java/com/arangodb/ArangoDBTest.java
@@ -321,7 +321,7 @@ public void updateUserDefaultDatabaseAccess() throws InterruptedException, Execu
final ArangoDBAsync arangoDB = new ArangoDBAsync.Builder().build();
try {
arangoDB.createUser(USER, PW).get();
- arangoDB.updateUserDefaultDatabaseAccess(USER, Permissions.RW).get();
+ arangoDB.grantDefaultDatabaseAccess(USER, Permissions.RW).get();
} finally {
arangoDB.deleteUser(USER).get();
}
@@ -332,7 +332,7 @@ public void updateUserDefaultCollectionAccess() throws InterruptedException, Exe
final ArangoDBAsync arangoDB = new ArangoDBAsync.Builder().build();
try {
arangoDB.createUser(USER, PW).get();
- arangoDB.updateUserDefaultCollectionAccess(USER, Permissions.RW).get();
+ arangoDB.grantDefaultCollectionAccess(USER, Permissions.RW).get();
} finally {
arangoDB.deleteUser(USER).get();
}
diff --git a/src/test/java/com/arangodb/ArangoDatabaseTest.java b/src/test/java/com/arangodb/ArangoDatabaseTest.java
index 615a77b..f84da4e 100644
--- a/src/test/java/com/arangodb/ArangoDatabaseTest.java
+++ b/src/test/java/com/arangodb/ArangoDatabaseTest.java
@@ -400,15 +400,20 @@ public void resetAccessUserNotFound() throws InterruptedException, ExecutionExce
}
@Test
- public void updateUserDefaultCollectionAccess() throws InterruptedException, ExecutionException {
+ public void grantDefaultCollectionAccess() throws InterruptedException, ExecutionException {
try {
arangoDB.createUser("user1", "1234").get();
- db.updateUserDefaultCollectionAccess("user1", Permissions.RW).get();
+ db.grantDefaultCollectionAccess("user1", Permissions.RW).get();
} finally {
arangoDB.deleteUser("user1").get();
}
}
+ @Test
+ public void getPermissions() throws ArangoDBException, InterruptedException, ExecutionException {
+ assertThat(Permissions.RW, is(db.getPermissions("root").get()));
+ }
+
@Test
public void query() throws InterruptedException, ExecutionException {
try {