Search in sources :

Example 1 with DatarouterUserByUserTokenLookup

use of io.datarouter.web.user.databean.DatarouterUser.DatarouterUserByUserTokenLookup in project datarouter by hotpads.

the class DatarouterUserService method assertUserDoesNotExist.

public void assertUserDoesNotExist(Long id, String userToken, String username) {
    DatarouterUser userWithId = getUserById(id);
    if (userWithId != null) {
        throw new IllegalArgumentException("DatarouterUser already exists with id=" + id);
    }
    DatarouterUser userWithUserToken = nodes.getByUserToken(new DatarouterUserByUserTokenLookup(userToken));
    if (userWithUserToken != null) {
        throw new IllegalArgumentException("DatarouterUser already exists with userToken=" + userToken);
    }
    DatarouterUser userWithEmail = nodes.getByUsername(new DatarouterUserByUsernameLookup(username));
    if (userWithEmail != null) {
        throw new IllegalArgumentException("DatarouterUser already exists with username=" + username);
    }
}
Also used : DatarouterUser(io.datarouter.web.user.databean.DatarouterUser) DatarouterUserByUsernameLookup(io.datarouter.web.user.databean.DatarouterUser.DatarouterUserByUsernameLookup) DatarouterUserByUserTokenLookup(io.datarouter.web.user.databean.DatarouterUser.DatarouterUserByUserTokenLookup)

Aggregations

DatarouterUser (io.datarouter.web.user.databean.DatarouterUser)1 DatarouterUserByUserTokenLookup (io.datarouter.web.user.databean.DatarouterUser.DatarouterUserByUserTokenLookup)1 DatarouterUserByUsernameLookup (io.datarouter.web.user.databean.DatarouterUser.DatarouterUserByUsernameLookup)1