com.arangodb.model.UserUpdateOptions Java Examples

The following examples show how to use com.arangodb.model.UserUpdateOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultUserOperation.java    From spring-data with Apache License 2.0 5 votes vote down vote up
@Override
public UserEntity replace(final UserUpdateOptions options) throws DataAccessException {
	try {
		return db.arango().replaceUser(username, options);
	} catch (final ArangoDBException e) {
		throw translateExceptionIfPossible(e);
	}
}
 
Example #2
Source File: ArangoDBTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void replaceUser() throws InterruptedException, ExecutionException {
    final ArangoDBAsync arangoDB = new ArangoDBAsync.Builder().build();
    try {
        final Map<String, Object> extra = new HashMap<>();
        extra.put("hund", false);
        arangoDB.createUser(USER, PW, new UserCreateOptions().extra(extra)).get();
        extra.remove("hund");
        extra.put("mund", true);
        {
            arangoDB.replaceUser(USER, new UserUpdateOptions().extra(extra))
                    .whenComplete((user, ex) -> {
                        assertThat(user, is(notNullValue()));
                        assertThat(user.getExtra().size(), is(1));
                        assertThat(user.getExtra().get("mund"), is(notNullValue()));
                        assertThat(Boolean.valueOf(String.valueOf(user.getExtra().get("mund"))), is(true));
                    })
                    .get();
        }
        {
            arangoDB.getUser(USER)
                    .whenComplete((user2, ex) -> {
                        assertThat(user2.getExtra().size(), is(1));
                        assertThat(user2.getExtra().get("mund"), is(notNullValue()));
                        assertThat(Boolean.valueOf(String.valueOf(user2.getExtra().get("mund"))), is(true));
                    })
                    .get();
        }
    } finally {
        arangoDB.deleteUser(USER).get();
    }
}
 
Example #3
Source File: ArangoDBTest.java    From arangodb-java-driver-async with Apache License 2.0 5 votes vote down vote up
@Test
public void updateUser() throws InterruptedException, ExecutionException {
    final ArangoDBAsync arangoDB = new ArangoDBAsync.Builder().build();
    try {
        final Map<String, Object> extra = new HashMap<>();
        extra.put("hund", false);
        arangoDB.createUser(USER, PW, new UserCreateOptions().extra(extra)).get();
        extra.put("hund", true);
        extra.put("mund", true);
        {
            arangoDB.updateUser(USER, new UserUpdateOptions().extra(extra))
                    .whenComplete((user, ex) -> {
                        assertThat(user, is(notNullValue()));
                        assertThat(user.getExtra().size(), is(2));
                        assertThat(user.getExtra().get("hund"), is(notNullValue()));
                        assertThat(Boolean.valueOf(String.valueOf(user.getExtra().get("hund"))), is(true));
                    })
                    .get();
        }
        arangoDB.getUser(USER)
                .whenComplete((user2, ex) -> {
                    assertThat(user2.getExtra().size(), is(2));
                    assertThat(user2.getExtra().get("hund"), is(notNullValue()));
                    assertThat(Boolean.valueOf(String.valueOf(user2.getExtra().get("hund"))), is(true));
                })
                .get();
    } finally {
        arangoDB.deleteUser(USER).get();
    }
}
 
Example #4
Source File: DefaultUserOperation.java    From spring-data with Apache License 2.0 5 votes vote down vote up
@Override
public UserEntity update(final UserUpdateOptions options) throws DataAccessException {
	try {
		return db.arango().updateUser(username, options);
	} catch (final ArangoDBException e) {
		throw translateExceptionIfPossible(e);
	}
}
 
Example #5
Source File: ArangoDBAsyncImpl.java    From arangodb-java-driver-async with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<UserEntity> updateUser(final String user, final UserUpdateOptions options) {
	return executor.execute(updateUserRequest(db().name(), user, options), UserEntity.class);
}
 
Example #6
Source File: ArangoDBAsyncImpl.java    From arangodb-java-driver-async with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<UserEntity> replaceUser(final String user, final UserUpdateOptions options) {
	return executor.execute(replaceUserRequest(db().name(), user, options), UserEntity.class);
}
 
Example #7
Source File: ArangoDBImpl.java    From arangodb-java-driver with Apache License 2.0 4 votes vote down vote up
@Override
public UserEntity updateUser(final String user, final UserUpdateOptions options) throws ArangoDBException {
    return executor.execute(updateUserRequest(db().name(), user, options), UserEntity.class);
}
 
Example #8
Source File: ArangoDBImpl.java    From arangodb-java-driver with Apache License 2.0 4 votes vote down vote up
@Override
public UserEntity replaceUser(final String user, final UserUpdateOptions options) throws ArangoDBException {
    return executor.execute(replaceUserRequest(db().name(), user, options), UserEntity.class);
}
 
Example #9
Source File: ArangoDBAsyncImpl.java    From arangodb-java-driver with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<UserEntity> updateUser(final String user, final UserUpdateOptions options) {
    return executor.execute(updateUserRequest(db().name(), user, options), UserEntity.class);
}
 
Example #10
Source File: ArangoDBAsyncImpl.java    From arangodb-java-driver with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<UserEntity> replaceUser(final String user, final UserUpdateOptions options) {
    return executor.execute(replaceUserRequest(db().name(), user, options), UserEntity.class);
}
 
Example #11
Source File: UserOperations.java    From spring-data with Apache License 2.0 2 votes vote down vote up
/**
 * Replaces the data of an existing user. You can only change the password of your self. You need access to the
 * _system database to change the active flag.
 *
 * @param options
 *            Additional properties of the user, can be null
 * @return information about the user
 * @throws DataAccessException
 */
UserEntity replace(UserUpdateOptions options) throws DataAccessException;
 
Example #12
Source File: ArangoDBAsync.java    From arangodb-java-driver-async with Apache License 2.0 2 votes vote down vote up
/**
 * Partially updates the data of an existing user. The name of an existing user must be specified in user. You can
 * only change the password of your self. You need access to the _system database to change the active flag.
 * 
 * @see <a href="https://docs.arangodb.com/current/HTTP/UserManagement/index.html#update-user">API Documentation</a>
 * @param user
 *            The name of the user
 * @param options
 *            Properties of the user to be changed
 * @return information about the user
 */
CompletableFuture<UserEntity> updateUser(final String user, final UserUpdateOptions options);
 
Example #13
Source File: ArangoDBAsync.java    From arangodb-java-driver-async with Apache License 2.0 2 votes vote down vote up
/**
 * Replaces the data of an existing user. The name of an existing user must be specified in user. You can only
 * change the password of your self. You need access to the _system database to change the active flag.
 * 
 * @see <a href="https://docs.arangodb.com/current/HTTP/UserManagement/index.html#replace-user">API
 *      Documentation</a>
 * @param user
 *            The name of the user
 * @param options
 *            Additional properties of the user, can be null
 * @return information about the user
 */
CompletableFuture<UserEntity> replaceUser(final String user, final UserUpdateOptions options);
 
Example #14
Source File: UserOperations.java    From spring-data with Apache License 2.0 2 votes vote down vote up
/**
 * Partially updates the data of an existing user. You can only change the password of your self. You need access to
 * the _system database to change the active flag.
 *
 * @param options
 *            Properties of the user to be changed
 * @return information about the user
 * @throws DataAccessException
 */
UserEntity update(UserUpdateOptions options) throws DataAccessException;
 
Example #15
Source File: ArangoDB.java    From arangodb-java-driver with Apache License 2.0 2 votes vote down vote up
/**
 * Partially updates the data of an existing user. The name of an existing user must be specified in user. You can
 * only change the password of your self. You need access to the _system database to change the active flag.
 *
 * @param user    The name of the user
 * @param options Properties of the user to be changed
 * @return information about the user
 * @throws ArangoDBException
 * @see <a href="https://www.arangodb.com/docs/stable/http/user-management.html#modify-user">API Documentation</a>
 */
UserEntity updateUser(String user, UserUpdateOptions options) throws ArangoDBException;
 
Example #16
Source File: ArangoDB.java    From arangodb-java-driver with Apache License 2.0 2 votes vote down vote up
/**
 * Replaces the data of an existing user. The name of an existing user must be specified in user. You can only
 * change the password of your self. You need access to the _system database to change the active flag.
 *
 * @param user    The name of the user
 * @param options Additional properties of the user, can be null
 * @return information about the user
 * @throws ArangoDBException
 * @see <a href="https://www.arangodb.com/docs/stable/http/user-management.html#replace-user">API
 * Documentation</a>
 */
UserEntity replaceUser(String user, UserUpdateOptions options) throws ArangoDBException;
 
Example #17
Source File: ArangoDBAsync.java    From arangodb-java-driver with Apache License 2.0 2 votes vote down vote up
/**
 * Partially updates the data of an existing user. The name of an existing user must be specified in user. You can
 * only change the password of your self. You need access to the _system database to change the active flag.
 *
 * @param user    The name of the user
 * @param options Properties of the user to be changed
 * @return information about the user
 * @see <a href="https://www.arangodb.com/docs/stable/http/user-management.html#modify-user">API Documentation</a>
 */
CompletableFuture<UserEntity> updateUser(final String user, final UserUpdateOptions options);
 
Example #18
Source File: ArangoDBAsync.java    From arangodb-java-driver with Apache License 2.0 2 votes vote down vote up
/**
 * Replaces the data of an existing user. The name of an existing user must be specified in user. You can only
 * change the password of your self. You need access to the _system database to change the active flag.
 *
 * @param user    The name of the user
 * @param options Additional properties of the user, can be null
 * @return information about the user
 * @see <a href="https://www.arangodb.com/docs/stable/http/user-management.html#replace-user">API
 * Documentation</a>
 */
CompletableFuture<UserEntity> replaceUser(final String user, final UserUpdateOptions options);