code: protected boolean hasPermission(final String permission) {
          if (getPrincipal() == null) {
              return false;
          }
          try (AlpineQueryManager qm = new AlpineQueryManager()) {
              boolean hasPermission = false;
              if (getPrincipal() instanceof ApiKey) {
                  hasPermission = qm.hasPermission((ApiKey)getPrincipal(), permission);
              } else if (getPrincipal() instanceof UserPrincipal) {
                  hasPermission = qm.hasPermission((UserPrincipal)getPrincipal(), permission, true);
              }
              return hasPermission;
          }
      }
docs: Convenience method that returns true if the principal has the specified permission,
  or false if not.
  @param permission the permission to check
  @return true if principal has permission assigned, false if not
  @since 1.2.0