code: @SuppressWarnings("unchecked")
      public boolean hasPermission(Authentication authentication,
                                   Serializable resource,
                                   String resourceType,
                                   Object privilege) {
          boolean logPermission = isLogPermission(resource);
          if (checkRole(authentication, privilege, logPermission)) {
              return true;
          }
          if (resource != null) {
              Object resourceId = ((Map<String, Object>) resource).get("id");
              if (resourceId != null) {
                  ((Map<String, Object>) resource).put(resourceType,
                      resourceFactory.getResource(resourceId, resourceType));
              }
          }
          return checkPermission(authentication, resource, privilege, true, logPermission);
      }
docs: Check permission for role, privilege key, new resource and old resource.
  @param authentication the authentication
  @param resource the old resource
  @param resourceType the resource type
  @param privilege the privilege key
  @return true if permitted