/** * Checks if the user with the given id has the required permission. * * @param userId The id of the user. * @param permission The permission to check. * @return If the user has the given permission. */ public boolean hasPermission(String userId, String permission) { if (permission.equals("none") || permission.equals("")) { return true; } List<String> permissions = this.permissions.get(userId); if (permissions == null) { return false; } for (String perm : permissions) { // user has the permission if (checkPermission(perm, permission)) { return true; } } // user hasn't enough permissions return false; }