Example usage for io.vertx.core.json JsonArray contains

List of usage examples for io.vertx.core.json JsonArray contains

Introduction

In this page you can find the example usage for io.vertx.core.json JsonArray contains.

Prototype

public boolean contains(Object value) 

Source Link

Document

Does the JSON array contain the specified value?

Usage

From source file:org.politrons.auth.impl.MongoUser.java

License:Open Source License

/**
 * Check wether the current user has the given permission
 * /*w  ww.  ja  va2 s  . c  o m*/
 * @param permission
 *          the permission to be checked
 * @param resultHandler
 *          resulthandler gets true, if permission is valid, otherwise false
 * 
 */
protected void doHasPermission(String permission, Handler<AsyncResult<Boolean>> resultHandler) {
    try {
        JsonArray userPermissions = principal.getJsonArray(mongoAuth.getPermissionField());
        resultHandler.handle(
                Future.succeededFuture(userPermissions != null && userPermissions.contains(permission)));
    } catch (Throwable e) {
        resultHandler.handle(Future.failedFuture(e));
    }
}