code: public boolean hasPermission(final Team team, String permissionName) {
          final Query query = pm.newQuery(Permission.class, "name == :permissionName && teams.contains(:team)");
          query.setResult("count(id)");
          return (Long) query.execute(permissionName, team) > 0;
      }
docs: Determines if the specified Team has been assigned the specified permission.
  @param team the Team to query
  @param permissionName the name of the permission
  @return true if the team has the permission assigned, false if not
  @since 1.0.0