Instruction:
作为 Java 安全专家，检测此代码中的安全漏洞：
## 内容1
### 文件路径：
xwiki-platform-core/pom.xml
### 代码内容：
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.xwiki.platform</groupId>
    <artifactId>xwiki-platform</artifactId>
    <version>12.9-SNAPSHOT</version>
  </parent>
  <artifactId>xwiki-platform-core</artifactId>
  <name>XWiki Platform - Core - Parent POM</name>
  <packaging>pom</packaging>
  <description>XWiki Platform - Core - Parent POM</description>
  <properties>

    <xwiki.minification.skip>false</xwiki.minification.skip>
  </properties>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>

              <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <systemProperties combine.children="append">

              <property>
                <name>screenshotDirectory</name>
                <value>${basedir}/target/screenshots</value>
              </property>
            </systemProperties>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.xwiki.commons</groupId>
              <artifactId>xwiki-commons-tool-test-simple</artifactId>
              <version>${commons.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <configuration>
            <systemProperties combine.children="append">

              <property>
                <name>screenshotDirectory</name>
                <value>${basedir}/target/screenshots</value>
              </property>
            </systemProperties>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
        <configuration>
          <analysisConfiguration>
            <revapi.filter>
              <archives>

                <exclude>
                  <item>org\.xwiki\.commons:.*:.*</item>
                  <item>org\.xwiki\.rendering:.*:.*</item>
                </exclude>
              </archives>
            </revapi.filter>

            <revapi.ignore>
              <item>
                java.method.returnTypeChanged
                <old>method org.xwiki.like.LikedEntity org.xwiki.like.LikeManager::getEntityLikes(org.xwiki.model.reference.EntityReference) throws org.xwiki.like.LikeException</old>
                <new>method long org.xwiki.like.LikeManager::getEntityLikes(org.xwiki.model.reference.EntityReference) throws org.xwiki.like.LikeException</new>
                <justification>Unstable API: not breaking.</justification>
              </item>
              <item>
                java.method.addedToInterface
                <new>method java.util.List<org.xwiki.user.UserReference> org.xwiki.like.LikeManager::getLikers(org.xwiki.model.reference.EntityReference, int, int) throws org.xwiki.like.LikeException</new>
                <justification>Unstable API: not breaking.</justification>
              </item>
                <item>
                java.method.numberOfParametersChanged
                <old>method java.util.List<org.xwiki.like.LikedEntity> org.xwiki.like.LikeManager::getUserLikes(org.xwiki.user.UserReference) throws org.xwiki.like.LikeException</old>
                <new>method java.util.List<org.xwiki.model.reference.EntityReference> org.xwiki.like.LikeManager::getUserLikes(org.xwiki.user.UserReference, int, int) throws org.xwiki.like.LikeException</new>
                <justification>Unstable API: not breaking.</justification>
              </item>
                <item>
                java.method.returnTypeChanged
                <old>method org.xwiki.like.LikedEntity org.xwiki.like.LikeManager::saveLike(org.xwiki.user.UserReference, org.xwiki.model.reference.EntityReference) throws org.xwiki.like.LikeException</old>
                <new>method long org.xwiki.like.LikeManager::saveLike(org.xwiki.user.UserReference, org.xwiki.model.reference.EntityReference) throws org.xwiki.like.LikeException</new>
                <justification>Unstable API: not breaking.</justification>
              </item>
                <item>
                java.class.removed
                <old>interface org.xwiki.like.LikedEntity</old>
                <justification>Unstable API: not breaking.</justification>
              </item>
                <item>
                java.method.numberOfParametersChanged
                <old>method java.util.List<org.xwiki.like.LikedEntity> org.xwiki.like.script.LikeScriptService::getUserLikes(org.xwiki.user.UserReference)</old>
                <new>method java.util.List<org.xwiki.model.reference.EntityReference> org.xwiki.like.script.LikeScriptService::getUserLikes(org.xwiki.user.UserReference, int, int)</new>
                <justification>Unstable API: not breaking.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.AbstractRatingEvent</old>
                <justification>Redesign of Ratings API: this class has actually been moved to org.xwiki.ratings.events.AbstractRatingEvent but deeply changed internally.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.addedToInterface
                <new>method .+ org.xwiki.ratings.AverageRating::.+</new>
                <justification>Redesign of Ratings API: Several new methods have been added to AverageRating class.</justification>
              </item>
              <item>
                java.method.removed
                <old>method void org.xwiki.ratings.AverageRating::save() throws org.xwiki.ratings.RatingsException</old>
                <justification>Redesign of Ratings API: This method has been removed since it should be handled by a dedicated manager and not there.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.removed
                <old>method void org.xwiki.ratings.AverageRating::set.+</old>
                <justification>Redesign of Ratings API: this interface now only provide getters.</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.lang.String org.xwiki.ratings.AverageRating::getMethod()</old>
                <justification>Redesign of Ratings API: this method is no longer needed with the new architecture.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.AverageRatingApi</old>
                <justification>Redesign of Ratings API: only the AverageRating interface should now be used.</justification>
              </item>
              <item>
                java.class.removed
                <old>interface org.xwiki.ratings.ConfiguredProvider<T></old>
                <justification>Redesign of Ratings API: this class is useless with the new architecture.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.ConfiguredRatingsManagerProvider</old>
                <justification>Redesign of Ratings API: this class is useless with the new architecture.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.ConfiguredReputationAlgorithmProvider</old>
                <justification>Redesign of Ratings API: the reputation is no longer supported by this extension.</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.lang.String org.xwiki.ratings.Rating::display(java.lang.String, java.lang.String)</old>
                <justification>Redesign of Ratings API: this method is not directly related to rating.</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.lang.Object org.xwiki.ratings.Rating::get(java.lang.String)</old>
                <justification>Redesign of Ratings API: this method was too generic for this API.</justification>
              </item>
              <item>
                java.method.removed
                <old>method com.xpn.xwiki.objects.BaseObject org.xwiki.ratings.Rating::getAsObject() throws org.xwiki.ratings.RatingsException</old>
                <justification>Redesign of Ratings API: this method implied that Rating were always stored as xobject which is not always true.</justification>
              </item>
              <item>
                java.method.returnTypeChanged
                <old>method org.xwiki.model.reference.DocumentReference org.xwiki.ratings.Rating::getAuthor()</old>
                <new>method org.xwiki.user.UserReference org.xwiki.ratings.Rating::getAuthor()</new>
                <justification>Redesign of Ratings API: Following our new User API practice, a user is represented by a UserReference.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.addedToInterface
                <new>method .+ org.xwiki.ratings.Rating::.+</new>
                <justification>Redesign of Ratings API: Rating interface expose now new data that are available through the interface.</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.util.Date org.xwiki.ratings.Rating::getDate()</old>
                <justification>Redesign of Ratings API: two dates are now available, the creation date and the last update date.</justification>
              </item>
              <item>
                java.method.removed
                <old>method org.xwiki.model.reference.DocumentReference org.xwiki.ratings.Rating::getDocumentReference()</old>
                <justification>Redesign of Ratings API: Rating is now not only for documents but for any entity. See Rating#getReference().</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.lang.String org.xwiki.ratings.Rating::getGlobalRatingId()</old>
                <justification>Redesign of Ratings API: there is now a unique ID available with Rating#getId().</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.lang.String org.xwiki.ratings.Rating::getRatingId()</old>
                <justification>Redesign of Ratings API: there is now a unique ID available with Rating#getId().</justification>
              </item>
              <item>
                java.method.removed
                <old>method boolean org.xwiki.ratings.Rating::remove() throws org.xwiki.ratings.RatingsException</old>
                <justification>Redesign of Ratings API: this API is now handled only through the RatingsManager.</justification>
              </item>
              <item>
                java.method.removed
                <old>method void org.xwiki.ratings.Rating::save() throws org.xwiki.ratings.RatingsException</old>
                <justification>Redesign of Ratings API: this API is now handled only through the RatingsManager.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.removed
                <old>method void org.xwiki.ratings.Rating::set.+</old>
                <justification>Redesign of Ratings API: Only getters are now available in this interface.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.addedToInterface
                <new>method .+ org.xwiki.ratings.RatingsConfiguration::.+</new>
                <justification>Redesign of Ratings API: RatingsConfiguration now defines configuration methods for Ratings. Check out the documentation.</justification>
              </item>
              <item>
                java.method.removed
                <old>method com.xpn.xwiki.doc.XWikiDocument org.xwiki.ratings.RatingsConfiguration::getConfigurationDocument(org.xwiki.model.reference.DocumentReference)</old>
                <justification>Redesign of Ratings API: RatingsConfiguration now defines configuration methods for Ratings. Check out the documentation.</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.lang.String org.xwiki.ratings.RatingsConfiguration::getConfigurationParameter(org.xwiki.model.reference.DocumentReference, java.lang.String, java.lang.String)</old>
                <justification>Redesign of Ratings API: RatingsConfiguration now defines configuration methods for Ratings. Check out the documentation.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.field.removedWithConstant
                <old>field .+ @ org.xwiki.ratings.RatingsException</old>
                <justification>Redesign of Ratings API: RatingsException does not extend anymore XWikiException.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.field.removedWithConstant
                <old>field org.xwiki.ratings.RatingsException.[A-Z_]+</old>
                <justification>Redesign of Ratings API: Error codes have been removed from RatingsException, we only rely on meaningfull messages.</justification>
              </item>
              <item>
                java.method.numberOfParametersChanged
                <old>method void org.xwiki.ratings.RatingsException::<init>()</old>
                <new>method void org.xwiki.ratings.RatingsException::<init>(java.lang.String)</new>
                <justification>Redesign of Ratings API: Error codes have been removed from RatingsException, we only rely on meaningfull messages.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.removed
                <old>method .+ org.xwiki.ratings.RatingsException::.+</old>
                <justification>Redesign of Ratings API: Error codes have been removed from RatingsException, we only rely on meaningfull messages.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.removed
                <old>method .+ com.xpn.xwiki.XWikiException::.+ @ org.xwiki.ratings.RatingsException</old>
                <justification>Redesign of Ratings API: RatingsException does not extend anymore XWikiException.</justification>
              </item>
              <item>
                java.class.noLongerInheritsFromClass
                <old>class org.xwiki.ratings.RatingsException</old>
                <new>class org.xwiki.ratings.RatingsException</new>
                <justification>Redesign of Ratings API: RatingsException does not extend anymore XWikiException.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.field.removedWithConstant
                <old>field org.xwiki.ratings.RatingsManager.[A-Z_]+</old>
                <justification>Redesign of Ratings API: Constants have been removed from RatingsManager since they were tightly linked to the storage representation.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.field.removed
                <old>field org.xwiki.ratings.RatingsManager.[A-Z_]+</old>
                <justification>Redesign of Ratings API: Constants have been removed from RatingsManager since they were tightly linked to the storage representation.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.addedToInterface
                <new>method .+ org.xwiki.ratings.RatingsManager::.+</new>
                <justification>Redesign of Ratings API: some new methods have been added because of new needs.</justification>
              </item>
              <item>
                java.method.parameterTypeChanged
                <old>parameter org.xwiki.ratings.AverageRating org.xwiki.ratings.RatingsManager::getAverageRating(===org.xwiki.model.reference.DocumentReference===) throws org.xwiki.ratings.RatingsException</old>
                <new>parameter org.xwiki.ratings.AverageRating org.xwiki.ratings.RatingsManager::getAverageRating(===org.xwiki.model.reference.EntityReference===) throws org.xwiki.ratings.RatingsException</new>
                <justification>Redesign of Ratings API: ratings now apply on entities not just documents.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.removed
                <old>method .+ org.xwiki.ratings.RatingsManager::.+</old>
                <justification>Redesign of Ratings API: the API of RatingsManager have been greatly simplified.</justification>
              </item>
              <item>
                java.method.numberOfParametersChanged
                <old>method java.util.List<org.xwiki.ratings.Rating> org.xwiki.ratings.RatingsManager::getRatings(org.xwiki.model.reference.DocumentReference, int, int, boolean) throws org.xwiki.ratings.RatingsException</old>
                <new>method java.util.List<org.xwiki.ratings.Rating> org.xwiki.ratings.RatingsManager::getRatings(java.util.Map<org.xwiki.ratings.RatingsManager.RatingQueryField, java.lang.Object>, int, int, org.xwiki.ratings.RatingsManager.RatingQueryField, boolean) throws org.xwiki.ratings.RatingsException</new>
                <justification>Redesign of Ratings API: the method to retrieve ratings in RatingsManager have been made more generic.</justification>
              </item>
              <item>
                java.method.parameterTypeChanged
                <old>parameter boolean org.xwiki.ratings.RatingsManager::removeRating(===org.xwiki.ratings.Rating===) throws org.xwiki.ratings.RatingsException</old>
                <new>parameter boolean org.xwiki.ratings.RatingsManager::removeRating(===java.lang.String===) throws org.xwiki.ratings.RatingsException</new>
                <justification>Redesign of Ratings API: the method to remove a rating in RatingsManager now only take an identifier.</justification>
              </item>
              <item>
                java.class.removed
                <old>interface org.xwiki.ratings.ReputationAlgorithm</old>
                <justification>Redesign of Ratings API: Reputation was never finished and is no longer supported in Ratings.</justification>
              </item>
              <item>
                java.class.removed
                <old>interface org.xwiki.ratings.ReputationAlgorithmGroovy</old>
                <justification>Redesign of Ratings API: Reputation was never finished and is no longer supported in Ratings.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.ReputationException</old>
                <justification>Redesign of Ratings API: Reputation was never finished and is no longer supported in Ratings.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.UpdateRatingEvent</old>
                <justification>Redesign of Ratings API: this class has been refactored, an equivalent is now in org.xwiki.ratings.events.UpdatedRatingEvent.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.UpdateRatingFailedEvent</old>
                <justification>Redesign of Ratings API: we removed the begin/end event for Ratings. They only exist for AverageRating for technical reasons.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.UpdatingRatingEvent</old>
                <justification>Redesign of Ratings API: we removed the begin/end event for Ratings. They only exist for AverageRating for technical reasons.</justification>
              </item>
              <item>
                java.class.removed
                <old>class org.xwiki.ratings.script.RatingApi</old>
                <justification>Redesign of Ratings API: only the Rating interface should now be used.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.removed
                <old>method org.xwiki.ratings.AverageRatingApi org.xwiki.ratings.script.RatingsScriptService::getUserReputation.*</old>
                <justification>Redesign of Ratings API: User reputation is not supported anymore.</justification>
              </item>
              <item>
                java.method.removed
                <old>method org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::getRating(com.xpn.xwiki.api.Document, java.lang.String)</old>
                <justification>Redesign of Ratings API: this method was already deprecated.</justification>
              </item>
              <item>
                java.method.removed
                <old>method org.xwiki.ratings.AverageRatingApi org.xwiki.ratings.script.RatingsScriptService::getAverageRating(com.xpn.xwiki.api.Document, java.lang.String)</old>
                <justification>Redesign of Ratings API: this method was already deprecated.</justification>
              </item>
              <item>
                java.method.removed
                <old>method com.xpn.xwiki.api.Document org.xwiki.ratings.script.RatingsScriptService::getConfigurationDocument(org.xwiki.model.reference.DocumentReference)</old>
                <justification>Redesign of Ratings API: this method does not make sense in the new design.</justification>
              </item>
              <item>
                java.method.parameterTypeChanged
                <old>parameter org.xwiki.ratings.AverageRatingApi org.xwiki.ratings.script.RatingsScriptService::getAverageRating(===com.xpn.xwiki.api.Document===)</old>
                <new>parameter java.util.Optional<org.xwiki.ratings.AverageRating> org.xwiki.ratings.script.AbstractScriptRatingsManager::getAverageRating(===org.xwiki.model.reference.EntityReference===) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: allow to retrieve average rating for any reference (not only DocumentReference).</justification>
              </item>
              <item>
                java.method.returnTypeChanged
                <old>method org.xwiki.ratings.AverageRatingApi org.xwiki.ratings.script.RatingsScriptService::getAverageRating(com.xpn.xwiki.api.Document)</old>
                <new>method java.util.Optional<org.xwiki.ratings.AverageRating> org.xwiki.ratings.script.AbstractScriptRatingsManager::getAverageRating(org.xwiki.model.reference.EntityReference) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: use new best practices for script service return if type is nullable.</justification>
              </item>
              <item>
                <regex>true</regex>
                java.method.removed
                <old>method org.xwiki.ratings.AverageRatingApi org.xwiki.ratings.script.RatingsScriptService::getAverageRating.*</old>
                <justification>Redesign of Ratings API: clean up of deprecated methods or methods that are not relevant on the new design.</justification>
              </item>
              <item>
                java.class.nonFinalClassInheritsFromNewClass
                <old>class org.xwiki.ratings.script.RatingsScriptService</old>
                <new>class org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: this change shouldn't impact using the script service.</justification>
              </item>
              <item>
                java.method.parameterTypeChanged
                <old>parameter org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::getRating(===com.xpn.xwiki.api.Document===, java.lang.String)</old>
                <new>parameter java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::getRating(===org.xwiki.model.reference.EntityReference===, org.xwiki.user.UserReference) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: allow to retrieve average rating for any reference (not only DocumentReference)</justification>
              </item>
              <item>
                java.method.parameterTypeChanged
                <old>parameter org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::getRating(com.xpn.xwiki.api.Document, ===java.lang.String===)</old>
                <new>parameter java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::getRating(org.xwiki.model.reference.EntityReference, ===org.xwiki.user.UserReference===) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: use new best practices for specifying a user by using the UserReference.</justification>
              </item>
                <item>
                java.method.returnTypeChanged
                <old>method org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::getRating(com.xpn.xwiki.api.Document, java.lang.String)</old>
                <new>method java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::getRating(org.xwiki.model.reference.EntityReference, org.xwiki.user.UserReference) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: use new best practices for script service return if type is nullable.</justification>
              </item>
              <item>
                java.method.removed
                <old>method org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::getRating(org.xwiki.model.reference.DocumentReference, org.xwiki.model.reference.DocumentReference)</old>
                <justification>Redesign of Ratings API: the changes above actually apply to that one.</justification>
              </item>
              <item>
                java.method.parameterTypeChanged
                <old>parameter java.util.List<org.xwiki.ratings.script.RatingApi> org.xwiki.ratings.script.RatingsScriptService::getRatings(===com.xpn.xwiki.api.Document===, int, int)</old>
                <new>parameter java.util.List<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::getRatings(===org.xwiki.model.reference.EntityReference===, int, int) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: allow to retrieve rating for any reference (not only DocumentReference)</justification>
              </item>
              <item>
                java.method.numberOfParametersChanged
                <old>method java.util.List<org.xwiki.ratings.script.RatingApi> org.xwiki.ratings.script.RatingsScriptService::getRatings(org.xwiki.model.reference.DocumentReference, int, int)</old>
                <new>method java.util.List<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::getRatings(org.xwiki.model.reference.EntityReference, int, int, boolean) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: actually the method with this number of parameter existed (see below)</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.util.List<org.xwiki.ratings.script.RatingApi> org.xwiki.ratings.script.RatingsScriptService::getRatings(org.xwiki.model.reference.DocumentReference, int, int, boolean)</old>
                <justification>Redesign of Ratings API: this method was actually not removed but we used an EntityReference instead of Document API. See above.</justification>
              </item>
              <item>
                java.method.removed
                <old>method java.util.List<org.xwiki.ratings.script.RatingApi> org.xwiki.ratings.script.RatingsScriptService::getRatings(com.xpn.xwiki.api.Document, int, int, boolean)</old>
                <justification>Redesign of Ratings API: removal of deprecated methods using Document parameter.</justification>
              </item>
              <item>
                java.method.numberOfParametersChanged
                <old>method org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::setRating(com.xpn.xwiki.api.Document, java.lang.String, int)</old>
                <new>method java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::setRating(org.xwiki.model.reference.EntityReference, int) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: removal of deprecated methods using Document parameter. A new API has been introduced and revapi considers it replaces it.</justification>
              </item>
              <item>
                java.method.returnTypeChanged
                <old>method org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::setRating(com.xpn.xwiki.api.Document, java.lang.String, int)</old>
                <new>method java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::setRating(org.xwiki.model.reference.EntityReference, int) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: use new best practices for script service return if type is nullable.</justification>
              </item>
                <item>
                java.method.parameterTypeChanged
                <old>parameter org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::setRating(===org.xwiki.model.reference.DocumentReference===, org.xwiki.model.reference.DocumentReference, int)</old>
                <new>parameter java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::setRating(===org.xwiki.model.reference.EntityReference===, org.xwiki.user.UserReference, int) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: allow to set rating for any reference (not only DocumentReference)</justification>
              </item>
                <item>
                java.method.parameterTypeChanged
                <old>parameter org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::setRating(org.xwiki.model.reference.DocumentReference, ===org.xwiki.model.reference.DocumentReference===, int)</old>
                <new>parameter java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::setRating(org.xwiki.model.reference.EntityReference, ===org.xwiki.user.UserReference===, int) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: use new best practices for specifying a user by using the UserReference.</justification>
              </item>
                <item>
                java.method.returnTypeChanged
                <old>method org.xwiki.ratings.script.RatingApi org.xwiki.ratings.script.RatingsScriptService::setRating(org.xwiki.model.reference.DocumentReference, org.xwiki.model.reference.DocumentReference, int)</old>
                <new>method java.util.Optional<org.xwiki.ratings.Rating> org.xwiki.ratings.script.AbstractScriptRatingsManager::setRating(org.xwiki.model.reference.EntityReference, org.xwiki.user.UserReference, int) @ org.xwiki.ratings.script.RatingsScriptService</new>
                <justification>Redesign of Ratings API: use new best practices for script service return if type is nullable.</justification>
              </item>
            </revapi.ignore>
          </analysisConfiguration>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <modules>

    <module>xwiki-platform-activeinstalls</module>
    <module>xwiki-platform-administration</module>
    <module>xwiki-platform-alerts</module>
    <module>xwiki-platform-annotation</module>
    <module>xwiki-platform-application</module>
    <module>xwiki-platform-appwithinminutes</module>
    <module>xwiki-platform-attachment</module>
    <module>xwiki-platform-autotag</module>
    <module>xwiki-platform-bridge</module>
    <module>xwiki-platform-captcha</module>
    <module>xwiki-platform-chart</module>
    <module>xwiki-platform-classloader</module>
    <module>xwiki-platform-component</module>
    <module>xwiki-platform-configuration</module>
    <module>xwiki-platform-container</module>
    <module>xwiki-platform-crypto</module>
    <module>xwiki-platform-csrf</module>
    <module>xwiki-platform-dashboard</module>
    <module>xwiki-platform-date</module>
    <module>xwiki-platform-diff</module>
    <module>xwiki-platform-diffplugin</module>
    <module>xwiki-platform-display</module>
    <module>xwiki-platform-edit</module>
    <module>xwiki-platform-eventstream</module>
    <module>xwiki-platform-extension</module>
    <module>xwiki-platform-feed</module>
    <module>xwiki-platform-filter</module>
    <module>xwiki-platform-flamingo</module>
    <module>xwiki-platform-flavor</module>
    <module>xwiki-platform-formula</module>
    <module>xwiki-platform-graphviz</module>
    <module>xwiki-platform-groovy</module>
    <module>xwiki-platform-help</module>
    <module>xwiki-platform-icon</module>
    <module>xwiki-platform-image</module>
    <module>xwiki-platform-index</module>
    <module>xwiki-platform-instance</module>
    <module>xwiki-platform-invitation</module>
    <module>xwiki-platform-job</module>
    <module>xwiki-platform-jodatime</module>
    <module>xwiki-platform-lesscss</module>
    <module>xwiki-platform-like</module>
    <module>xwiki-platform-linkchecker</module>
    <module>xwiki-platform-livetable</module>
    <module>xwiki-platform-localization</module>
    <module>xwiki-platform-logging</module>
    <module>xwiki-platform-mail</module>
    <module>xwiki-platform-mailsender</module>
    <module>xwiki-platform-mentions</module>
    <module>xwiki-platform-menu</module>
    <module>xwiki-platform-messagestream</module>
    <module>xwiki-platform-minimaldependencies</module>
    <module>xwiki-platform-model</module>
    <module>xwiki-platform-notifications</module>
    <module>xwiki-platform-observation</module>
    <module>xwiki-platform-office</module>
    <module>xwiki-platform-oldcore</module>
    <module>xwiki-platform-panels</module>
    <module>xwiki-platform-query</module>
    <module>xwiki-platform-ratings</module>
    <module>xwiki-platform-refactoring</module>
    <module>xwiki-platform-release</module>
    <module>xwiki-platform-rendering</module>
    <module>xwiki-platform-repository</module>
    <module>xwiki-platform-resource</module>
    <module>xwiki-platform-rest</module>
    <module>xwiki-platform-sandbox</module>
    <module>xwiki-platform-sharepage</module>
    <module>xwiki-platform-scheduler</module>
    <module>xwiki-platform-search</module>
    <module>xwiki-platform-security</module>
    <module>xwiki-platform-sheet</module>
    <module>xwiki-platform-skin</module>
    <module>xwiki-platform-statistics</module>
    <module>xwiki-platform-store</module>
    <module>xwiki-platform-svg</module>
    <module>xwiki-platform-tag</module>
    <module>xwiki-platform-template</module>
    <module>xwiki-platform-test</module>
    <module>xwiki-platform-tika</module>
    <module>xwiki-platform-tree</module>
    <module>xwiki-platform-user</module>
    <module>xwiki-platform-uiextension</module>
    <module>xwiki-platform-url</module>
    <module>xwiki-platform-velocity</module>
    <module>xwiki-platform-vfs</module>
    <module>xwiki-platform-web</module>
    <module>xwiki-platform-webjars</module>
    <module>xwiki-platform-wiki</module>
    <module>xwiki-platform-wysiwyg</module>
    <module>xwiki-platform-xar</module>
    <module>xwiki-platform-xclass</module>
    <module>xwiki-platform-xml</module>
    <module>xwiki-platform-zipexplorer</module>
  </modules>
  <profiles>

    <profile>
      <id>legacy</id>
      <modules>
        <module>xwiki-platform-legacy</module>
      </modules>
    </profile>
    <profile>
      <id>docker</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <systemProperties combine.children="append">

                  <property>
                    <name>oracle.jdbc.timezoneAsRegion</name>
                    <value>false</value>
                  </property>
                </systemProperties>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>

## 内容2
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/src/main/java/org/xwiki/like/LikeManager.java
### 代码内容：
/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.like;

import java.util.List;

import org.xwiki.component.annotation.Role;
import org.xwiki.model.reference.EntityReference;
import org.xwiki.security.authorization.Right;
import org.xwiki.stability.Unstable;
import org.xwiki.user.UserReference;

/**
 * General manager to handle likes.
 *
 * @version $Id$
 * @since 12.7RC1
 */
@Role
@Unstable
public interface LikeManager
{
    /**
     * Create a page like and save it.
     *
     * @param source the user who performs the like.
     * @param target the page or object to like.
     * @return the new number of likes.
     * @throws LikeException in case of problem when saving the like.
     */
    long saveLike(UserReference source, EntityReference target) throws LikeException;

    /**
     * Retrieve the likes performed by the given user.
     *
     * @param source the user for whom to retrieve the entity likes.
     * @param offset the offset used for pagination.
     * @param limit the limit number of results to retrieve for pagination.
     * @return a list of references liked by this user.
     * @throws LikeException in case of problem when getting the like.
     */
    List<EntityReference> getUserLikes(UserReference source, int offset, int limit) throws LikeException;

    /**
     * Retrieve like information a specific entity.
     *
     * @param target the page or object for which to retrieve the like information.
     * @return the number of likes for that entity.
     * @throws LikeException in case of problem when getting the like.
     */
    long getEntityLikes(EntityReference target) throws LikeException;

    /**
     * Allow a user to unlike an entity.
     *
     * @param source the user who performs the unlike.
     * @param target the entity to unlike.
     * @return {@code true} if the entity has been properly unliked.
     * @throws LikeException in case of problem when removing the like.
     */
    boolean removeLike(UserReference source, EntityReference target) throws LikeException;

    /**
     * Check if an entity is liked by an user without loading all likers.
     *
     * @param source the user who might have liked.
     * @param target the entity which might have been liked.
     * @return {@code true} if the user liked the page already.
     * @throws LikeException in case of problem for loading the result.
     */
    boolean isLiked(UserReference source, EntityReference target) throws LikeException;

    /**
     * Retrieve the users who liked the given reference.
     *
     * @param target the page that has been liked.
     * @param offset the offset used for pagination.
     * @param limit the limit used for pagination.
     * @return a list of user references of users who liked this page.
     * @throws LikeException in case of problem for performing the query.
     */
    List<UserReference> getLikers(EntityReference target, int offset, int limit) throws LikeException;

    /**
     * @return a dedicated programmatic right for Like feature.
     */
    Right getLikeRight();
}

## 内容3
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/src/main/java/org/xwiki/like/internal/DefaultLikeManager.java
### 代码内容：
/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.like.internal;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.xwiki.cache.Cache;
import org.xwiki.cache.CacheException;
import org.xwiki.cache.CacheManager;
import org.xwiki.cache.config.LRUCacheConfiguration;
import org.xwiki.component.annotation.Component;
import org.xwiki.component.manager.ComponentLifecycleException;
import org.xwiki.component.phase.Disposable;
import org.xwiki.component.phase.Initializable;
import org.xwiki.component.phase.InitializationException;
import org.xwiki.like.LikeConfiguration;
import org.xwiki.like.LikeEvent;
import org.xwiki.like.LikeException;
import org.xwiki.like.LikeManager;
import org.xwiki.like.UnlikeEvent;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.model.reference.EntityReference;
import org.xwiki.model.reference.EntityReferenceSerializer;
import org.xwiki.observation.ObservationManager;
import org.xwiki.ratings.Rating;
import org.xwiki.ratings.RatingsException;
import org.xwiki.ratings.RatingsManager;
import org.xwiki.ratings.RatingsManagerFactory;
import org.xwiki.security.authorization.AuthorizationManager;
import org.xwiki.security.authorization.Right;
import org.xwiki.security.authorization.UnableToRegisterRightException;
import org.xwiki.user.UserReference;
import org.xwiki.user.UserReferenceSerializer;

/**
 * Default implementation of {@link LikeManager} based on {@link RatingsManager}.
 *
 * @version $Id$
 * @since 12.7RC1
 */
@Component
@Singleton
public class DefaultLikeManager implements LikeManager, Initializable, Disposable
{
    private static final int DEFAULT_LIKE_VOTE = 1;

    @Inject
    private RatingsManagerFactory ratingsManagerFactory;

    @Inject
    @Named("document")
    private UserReferenceSerializer<DocumentReference> userReferenceDocumentSerializer;

    @Inject
    private UserReferenceSerializer<String> userReferenceStringSerializer;

    @Inject
    private EntityReferenceSerializer<String> entityReferenceSerializer;

    @Inject
    private AuthorizationManager authorizationManager;

    @Inject
    private ObservationManager observationManager;

    @Inject
    private CacheManager cacheManager;

    @Inject
    private LikeConfiguration likeConfiguration;

    private RatingsManager ratingsManager;

    private Cache<Long> likeCountCache;

    private Cache<Boolean> likeExistCache;

    private Right likeRight;

    @Override
    public void initialize() throws InitializationException
    {
        int likeCacheCapacity = this.likeConfiguration.getLikeCacheCapacity();
        try {
            this.likeCountCache = this.cacheManager.createNewCache(
                new LRUCacheConfiguration("xwiki.like.count.cache", likeCacheCapacity));
            this.likeExistCache = this.cacheManager.createNewCache(
                new LRUCacheConfiguration("xwiki.like.exist.cache", likeCacheCapacity));
            this.likeRight = this.authorizationManager.register(LikeRight.INSTANCE);
        } catch (UnableToRegisterRightException e) {
            throw new InitializationException("Error while registering the Like right.", e);
        } catch (CacheException e) {
            throw new InitializationException("Error while creating the cache for likes.", e);
        }

        try {
            this.ratingsManager = this.ratingsManagerFactory
                .getRatingsManager(LikeRatingsConfiguration.RANKING_MANAGER_HINT);
        } catch (RatingsException e) {
            throw new InitializationException("Error while trying to get the RankingManager.", e);
        }
    }

    @Override
    public void dispose() throws ComponentLifecycleException
    {
        //this.authorizationManager.
    }

    private String getExistCacheKey(UserReference source, EntityReference target)
    {
        return String.format("%s_%s",
            this.userReferenceStringSerializer.serialize(source), this.entityReferenceSerializer.serialize(target));
    }

    @Override
    public long saveLike(UserReference source, EntityReference target) throws LikeException
    {
        DocumentReference userDoc = this.userReferenceDocumentSerializer.serialize(source);
        if (this.authorizationManager.hasAccess(this.likeRight, userDoc, target)) {
            try {
                this.ratingsManager.saveRating(target, source, DEFAULT_LIKE_VOTE);
                this.likeCountCache.remove(this.entityReferenceSerializer.serialize(target));
                this.likeExistCache.set(getExistCacheKey(source, target), true);
                long newCount = this.getEntityLikes(target);
                this.observationManager.notify(new LikeEvent(), source, target);
                return newCount;
            } catch (RatingsException e) {
                throw new LikeException(String.format("Error while liking entity [%s]", target), e);
            }
        } else {
            throw new LikeException(String.format("User [%s] is not authorized to perform a like on [%s]",
                source, target));
        }
    }

    @Override
    public List<EntityReference> getUserLikes(UserReference source, int offset, int limit) throws LikeException
    {
        try {
            List<Rating> ratings = this.ratingsManager.getRatings(
                Collections.singletonMap(RatingsManager.RatingQueryField.USER_REFERENCE, source),
                offset,
                limit,
                RatingsManager.RatingQueryField.UPDATED_DATE,
                false);
            return ratings.stream().map(Rating::getReference).collect(Collectors.toList());
        } catch (RatingsException e) {
            throw new LikeException(
                String.format("Error when trying to retrieve user likes for user [%s]", source), e);
        }
    }

    @Override
    public long getEntityLikes(EntityReference target) throws LikeException
    {
        Long result = this.likeCountCache.get(this.entityReferenceSerializer.serialize(target));
        if (result == null) {
            Map<RatingsManager.RatingQueryField, Object> queryMap = new LinkedHashMap<>();
            queryMap.put(RatingsManager.RatingQueryField.ENTITY_TYPE, target.getType());
            queryMap.put(RatingsManager.RatingQueryField.ENTITY_REFERENCE, target);
            try {
                result = this.ratingsManager.countRatings(queryMap);
                this.likeCountCache.set(this.entityReferenceSerializer.serialize(target), result);
            } catch (RatingsException e) {
                throw
                    new LikeException(String.format("Error while getting ratings for entity [%s]", target), e);
            }
        }
        return result;
    }

    @Override
    public boolean removeLike(UserReference source, EntityReference target) throws LikeException
    {
        String serializedTarget = this.entityReferenceSerializer.serialize(target);
        DocumentReference userDoc = this.userReferenceDocumentSerializer.serialize(source);
        boolean result = false;
        if (this.authorizationManager.hasAccess(this.getLikeRight(), userDoc, target)) {
            Map<RatingsManager.RatingQueryField, Object> queryMap = new LinkedHashMap<>();
            queryMap.put(RatingsManager.RatingQueryField.ENTITY_TYPE, target.getType());
            queryMap.put(RatingsManager.RatingQueryField.ENTITY_REFERENCE, target);
            queryMap.put(RatingsManager.RatingQueryField.USER_REFERENCE, source);

            try {
                List<Rating> ratings =
                    this.ratingsManager
                        .getRatings(queryMap, 0, 1, RatingsManager.RatingQueryField.UPDATED_DATE, false);
                if (!ratings.isEmpty()) {
                    result = this.ratingsManager.removeRating(ratings.get(0).getId());
                    this.likeCountCache.remove(serializedTarget);
                    this.likeExistCache.set(getExistCacheKey(source, target), false);
                    this.observationManager.notify(new UnlikeEvent(), source, target);
                }
            } catch (RatingsException e) {
                throw new LikeException("Error while removing grading", e);
            }
        } else {
            throw new LikeException(
                String.format("User [%s] is not authorized to remove a like on [%s].",
                    userDoc, target));
        }
        return result;
    }

    @Override
    public boolean isLiked(UserReference source, EntityReference target) throws LikeException
    {
        Boolean result = this.likeExistCache.get(getExistCacheKey(source, target));
        if (result == null) {
            Map<RatingsManager.RatingQueryField, Object> queryMap = new LinkedHashMap<>();
            queryMap.put(RatingsManager.RatingQueryField.ENTITY_TYPE, target.getType());
            queryMap.put(RatingsManager.RatingQueryField.ENTITY_REFERENCE, target);
            queryMap.put(RatingsManager.RatingQueryField.USER_REFERENCE, source);

            try {
                List<Rating> ratings =
                    this.ratingsManager
                        .getRatings(queryMap, 0, 1, RatingsManager.RatingQueryField.UPDATED_DATE, false);
                result = !ratings.isEmpty();
                this.likeExistCache.set(getExistCacheKey(source, target), result);
            } catch (RatingsException e) {
                throw new LikeException("Error while checking if grading exists", e);
            }
        }
        return result;
    }

    @Override
    public List<UserReference> getLikers(EntityReference target, int offset, int limit) throws LikeException
    {
        Map<RatingsManager.RatingQueryField, Object> queryMap = new LinkedHashMap<>();
        queryMap.put(RatingsManager.RatingQueryField.ENTITY_TYPE, target.getType());
        queryMap.put(RatingsManager.RatingQueryField.ENTITY_REFERENCE, target);
        try {
            List<Rating> ratings = this.ratingsManager
                .getRatings(queryMap, offset, limit, RatingsManager.RatingQueryField.UPDATED_DATE, false);
            return ratings.stream().map(Rating::getAuthor).collect(Collectors.toList());
        } catch (RatingsException e) {
            throw new LikeException(String.format("Error while getting likers of [%s]", target), e);
        }
    }

    @Override
    public Right getLikeRight()
    {
        return this.likeRight;
    }
}

## 内容4
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/src/main/java/org/xwiki/like/script/LikeScriptService.java
### 代码内容：
/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.like.script;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.xwiki.component.annotation.Component;
import org.xwiki.like.LikeConfiguration;
import org.xwiki.like.LikeException;
import org.xwiki.like.LikeManager;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.model.reference.EntityReference;
import org.xwiki.model.reference.LocalDocumentReference;
import org.xwiki.rendering.async.internal.AsyncRendererCache;
import org.xwiki.script.service.ScriptService;
import org.xwiki.security.authorization.AuthorizationManager;
import org.xwiki.security.authorization.Right;
import org.xwiki.stability.Unstable;
import org.xwiki.user.UserReference;
import org.xwiki.user.UserReferenceResolver;

import com.xpn.xwiki.XWikiContext;

/**
 * Script service for manipulating Like informations.
 *
 * @version $Id$
 * @since 12.7RC1
 */
@Component
@Singleton
@Named("like")
@Unstable
public class LikeScriptService implements ScriptService
{
    private static final LocalDocumentReference UIX_REFERENCE =
        new LocalDocumentReference(new LocalDocumentReference(Arrays.asList("XWiki", "Like"), "LikeUIX"), Locale.ROOT);

    @Inject
    private Provider<XWikiContext> contextProvider;

    @Inject
    private LikeManager likeManager;

    @Inject
    private LikeConfiguration likeConfiguration;

    @Inject
    private AuthorizationManager authorizationManager;

    @Inject
    @Named("document")
    private UserReferenceResolver<DocumentReference> userReferenceResolver;

    @Inject
    private AsyncRendererCache asyncRendererCache;

    @Inject
    private Logger logger;

    private Right getLikeRight()
    {
        return this.likeManager.getLikeRight();
    }

    /**
     * Check if current user is allowed to use Like on the given reference.
     * Note that we explicitely deny the right for guests.
     * @param entityReference the reference on which to use like.
     * @return {@code true} only if current user is not guest and has Like right on the reference.
     */
    public boolean isAuthorized(EntityReference entityReference)
    {
        DocumentReference userReference = this.contextProvider.get().getUserReference();
        return userReference != null && this.authorizationManager.hasAccess(getLikeRight(),
            userReference, entityReference);
    }

    /**
     * Check if the display button should be displayed: should be {@code true} if current user is authorized to use like
     * (see {@link #isAuthorized(EntityReference)}) or if the configuration is set to always display it
     * (see {@link LikeConfiguration#alwaysDisplayButton()}).
     *
     * @param entityReference the reference for which to display the button
     * @return {@code true} only if the button should be displayed.
     */
    public boolean displayButton(EntityReference entityReference)
    {
        return this.likeConfiguration.alwaysDisplayButton() || this.isAuthorized(entityReference);
    }

    /**
     * Perform a like on the given reference with the current user, only if allowed.
     *
     * @param entityReference the reference on which to perform a like.
     * @return the new number of likes if the operation succeeded, else return an empty optional.
     */
    public Optional<Long> like(EntityReference entityReference)
    {
        XWikiContext xWikiContext = this.contextProvider.get();
        DocumentReference currentUser = xWikiContext.getUserReference();

        if (entityReference instanceof DocumentReference) {
            DocumentReference documentReference = (DocumentReference) entityReference;
            if (isAuthorized(documentReference)) {
                UserReference userReference = this.userReferenceResolver.resolve(currentUser);
                try {
                    return Optional.of(this.likeManager.saveLike(userReference, documentReference));
                } catch (LikeException e) {
                    this.logger.warn("Error while liking [{}] by [{}]", documentReference, currentUser,
                        ExceptionUtils.getRootCause(e));
                }
            } else {
                this.logger.warn("[{}] is not authorized to like [{}].", currentUser, documentReference);
            }
        } else {
            this.logger.warn("Like is only implemented for document for now. (Called with [{}])", entityReference);
        }
        return Optional.empty();
    }

    /**
     * Perform a unlike on the given reference with the current user, only if allowed.
     *
     * @param entityReference the reference on which to perform a like.
     * @return the new number of likes if the operation succeeded, else return an empty optional.
     */
    public Optional<Long> unlike(EntityReference entityReference)
    {
        XWikiContext xWikiContext = this.contextProvider.get();
        DocumentReference currentUser = xWikiContext.getUserReference();

        if (entityReference instanceof DocumentReference) {
            DocumentReference documentReference = (DocumentReference) entityReference;
            if (this.isAuthorized(documentReference)) {
                UserReference userReference = this.userReferenceResolver.resolve(currentUser);
                try {
                    this.likeManager.removeLike(userReference, entityReference);
                    return Optional.of(this.likeManager.getEntityLikes(entityReference));
                } catch (LikeException e) {
                    this.logger.warn("Error while unliking [{}] by [{}]", documentReference, currentUser,
                        ExceptionUtils.getRootCause(e));
                }
            } else {
                this.logger.warn("[{}] is not authorized to unlike [{}].", currentUser, documentReference);
            }
        } else {
            this.logger.warn("Unlike is only implemented for document for now. (Called with [{}])", entityReference);
        }
        return Optional.empty();
    }

    /**
     * Retrieve like information for the given reference.
     *
     * @param entityReference the reference for which to retrieve like information.
     * @return the number of likes, or an empty optional in case of problem.
     */
    public Optional<Long> getLikes(EntityReference entityReference)
    {
        try {
            return Optional.of(this.likeManager.getEntityLikes(entityReference));
        } catch (LikeException e) {
            this.logger.warn("Error while getting like information for [{}]", entityReference,
                ExceptionUtils.getRootCause(e));
        }
        return Optional.empty();
    }

    /**
     * Retrieve likes performed by the given user.
     *
     * @param userReference the user for whom to retrieve likes.
     * @param offset the offset used for pagination.
     * @param limit the limit used for pagination.
     * @return a list of liked references.
     */
    public List<EntityReference> getUserLikes(UserReference userReference, int offset, int limit)
    {
        try {
            return this.likeManager.getUserLikes(userReference, offset, limit);
        } catch (LikeException e) {
            this.logger.warn("Error while retrieving likes for user [{}]", userReference,
                ExceptionUtils.getRootCause(e));
        }
        return Collections.emptyList();
    }

    /**
     * Determine if the current user already liked the given reference.
     * @param entityReference the reference for which to check if the current liked it or not already.
     * @return {@code true} if the entity has been already liked.
     */
    public boolean isLiked(EntityReference entityReference)
    {
        UserReference userReference = this.userReferenceResolver.resolve(this.contextProvider.get().getUserReference());

        try {
            return this.likeManager.isLiked(userReference, entityReference);
        } catch (LikeException e) {
            this.logger.warn("Error while checking if [{}] is liked by [{}]", entityReference, userReference,
                ExceptionUtils.getRootCause(e));
        }
        return false;
    }

    /**
     * Return the likers of a reference.
     *
     * @param target the reference being liked.
     * @param offset the start offset for pagination.
     * @param limit the limit of results for pagination.
     * @return a list of user references who liked the reference.
     * @since 12.8RC1
     */
    @Unstable
    public List<UserReference> getLikers(EntityReference target, int offset, int limit)
    {
        try {
            return this.likeManager.getLikers(target, offset, limit);
        } catch (LikeException e) {
            this.logger.warn("Error while checking getting likers for [{}]", target, ExceptionUtils.getRootCause(e));
        }
        return Collections.emptyList();
    }

    /**
     * Clean the async rendering cache for the Like UIX.
     */
    public void cleanCacheUIX()
    {
        DocumentReference localUIXReference = new DocumentReference(UIX_REFERENCE,
            contextProvider.get().getWikiReference());
        this.asyncRendererCache.cleanCache(localUIXReference);
    }
}

## 内容5
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/src/main/resources/templates/likers.vm
### 代码内容：
## ---------------------------------------------------------------------------
## See the NOTICE file distributed with this work for additional
## information regarding copyright ownership.
##
## This is free software; you can redistribute it and/or modify it
## under the terms of the GNU Lesser General Public License as
## published by the Free Software Foundation; either version 2.1 of
## the License, or (at your option) any later version.
##
## This software is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this software; if not, write to the Free
## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
## 02110-1301 USA, or see the FSF site: http://www.fsf.org.
## ---------------------------------------------------------------------------
#set ($likers = $services.like.getLikers($doc, 0, 50))

$services.localization.render('like.likers.title', [$doc.title])

    #if ($likers.isEmpty())
        $services.localization.render('like.likers.empty')
    #else

          $services.localization.render('like.likers.number', [$likers.size()])

          #foreach($liker in $likers)

#displayUserLink($liker)

          #end

    #end

## 内容6
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/LikeTranslations.de.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.LikeTranslations" locale="de">
  <web>XWiki.Like</web>
  <name>LikeTranslations</name>
  <language>de</language>
  <defaultLanguage>en</defaultLanguage>
  <translation>1</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>Main.WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title>LikeTranslations</title>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>plain/1.0</syntaxId>
  <hidden>true</hidden>
  <content>rightsmanager.like=Gefällt mir
like.unlike.modal.title="Gefällt mir nicht mehr" Bestätigung
like.unlike.modal.body=Sie sind Sie sicher, dass Sie Ihr "Gefällt mir" für die Seite {0} entfernen möchten?
like.unlike.modal.closeButton=Schließen
like.unlike.modal.unlikeButton="Gefällt mir" entfernen
like.unlike.modal.viewLikersButton="Gefällt mir" anzeigen
like.newlike.success="Gefällt mir" hinzugefügt.
like.newlike.error=Fehler beim setzen des "Gefällt mir".
like.unlike.success=Die Seite gefällt Ihnen nun nicht mehr.
like.unlike.error=Fehler beim Entfernen des "Gefällt mir".
like.userprofile.menu="Gefällt mir" Seiten
like.button.title=Anzahl der "Gefällt mir" auf der Seite: {0}
### Missing: like.button.title.like=Click to like the current page. Number of likes on this page: {0}.
### Missing: like.button.title.unlike=Click to unlike the current page. Number of likes on this page: {0}.
like.likers.empty=Niemandem gefällt diese Seite bisher.
like.likers.number={0} Personen gefällt die Seite:
like.likers.title={0} Gefällt mir
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton="Gefällt mir" Schaltfläche immer anzeigen
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton.hint=Die "Gefällt mir" Schaltfläche immer anzeigen - selbst wenn der Nutzer kein Recht hat diese zu benutzen. Anschalten, um die Anzahl der "Gefällt mir" immer anzuzeigen.
XWiki.Like.LikeConfigurationClass_cacheCapacity=Cache-Größe
XWiki.Like.LikeConfigurationClass_cacheCapacity.hint=Anzahl der "Gefällt mir"-Informationen im Cache. Sie müssen XWiki neustarten, damit veränderte Einstellungen angewendet werden.</content>

</xwikidoc>

## 内容7
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/LikeTranslations.es.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.LikeTranslations" locale="es">
  <web>XWiki.Like</web>
  <name>LikeTranslations</name>
  <language>es</language>
  <defaultLanguage>en</defaultLanguage>
  <translation>1</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>Main.WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title>LikeTranslations</title>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>plain/1.0</syntaxId>
  <hidden>true</hidden>
  <content>rightsmanager.like=Me gusta
like.unlike.modal.title=Confirmación de "ya no me gusta"
like.unlike.modal.body=¿Estás seguro que deseas eliminar tu "Me gusta" de la página {0}?
like.unlike.modal.closeButton=Cerrar
like.unlike.modal.unlikeButton=Ya no me gusta la página
like.unlike.modal.viewLikersButton=Me gusta
like.newlike.success=La página ha recibido algún "Me gusta".
like.newlike.error=Error al intentar dar "me gusta" a la página.
like.unlike.success=La página ha recibido algún "Ya no me gusta".
like.unlike.error=Error al intentar dar "ya no me gusta" a la página.
like.userprofile.menu=Páginas que me gustan
like.button.title=Número de "Me gusta" de esta página: {0}
### Missing: like.button.title.like=Click to like the current page. Number of likes on this page: {0}.
### Missing: like.button.title.unlike=Click to unlike the current page. Number of likes on this page: {0}.
like.likers.empty=Todavía no le gusta a nadie esta página.
like.likers.number={0} person(as) le gustas esta página:
like.likers.title="Me gusta" en {0}
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton=Mostrar siempre el botón "Me gusta"
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton.hint=Mostrar el botón incluso si el usuario no tiene derecho de interaccionar con él.  Úsalo si deseas mostrar siempre el contador de "Me gusta".
XWiki.Like.LikeConfigurationClass_cacheCapacity=Capacidad de la caché
XWiki.Like.LikeConfigurationClass_cacheCapacity.hint=Número de información de "Me gusta" guardada en la caché. Ten en cuenta que tienes que reiniciar XWiki para que se activen los cambios de esta opción.</content>

</xwikidoc>

## 内容8
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/LikeTranslations.fr.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.LikeTranslations" locale="fr">
  <web>XWiki.Like</web>
  <name>LikeTranslations</name>
  <language>fr</language>
  <defaultLanguage>en</defaultLanguage>
  <translation>1</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>Main.WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title>LikeTranslations</title>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>plain/1.0</syntaxId>
  <hidden>true</hidden>
  <content>rightsmanager.like=Aimer
like.unlike.modal.title=Confirmation de suppression du J'aime
like.unlike.modal.body=Êtes-vous sûr de vouloir enlever votre J''aime de la page {0} ?
like.unlike.modal.closeButton=Fermer
like.unlike.modal.unlikeButton=Je n'aime plus la page
like.unlike.modal.viewLikersButton=J'aime
like.newlike.success=Cette page a été aimée.
like.newlike.error=Erreur en essayant d'aimer une page.
like.unlike.success=Cette page n'est plus aimée.
like.unlike.error=Erreur en essayant de ne plus aimer une page.
like.userprofile.menu=Pages Aimées
like.button.title=Nombre de J''aime sur cette page : {0}
like.button.title.like=Cliquez pour aimer cette page. Actuellement {0} "J''aime" pour cette page.
like.button.title.unlike=Cliquez pour ne plus aimer cette page. Actuellement {0} "J''aime" pour cette page.
like.likers.empty=Personne n'aime encore cette page.
like.likers.number={0} personne(s) aime(nt) cette page :
like.likers.title=J''aime sur {0}
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton=Toujours afficher le bouton J'aime
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton.hint=Afficher le bouton même si l'utilisateur n'a pas les droits pour intéragir avec. Utilisez cette option si vous souhaitez toujours afficher le compteur de J'aime.
XWiki.Like.LikeConfigurationClass_cacheCapacity=Capacité du Cache
XWiki.Like.LikeConfigurationClass_cacheCapacity.hint=Nombre d'information J'aime à conserver dans le cache. Notez que vous devrez redémarrer XWiki pour que cette option soit prise en compte.</content>

</xwikidoc>

## 内容9
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/LikeTranslations.no.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.LikeTranslations" locale="no">
  <web>XWiki.Like</web>
  <name>LikeTranslations</name>
  <language>no</language>
  <defaultLanguage>en</defaultLanguage>
  <translation>1</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>Main.WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title>LikeTranslations</title>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>plain/1.0</syntaxId>
  <hidden>true</hidden>
  <content>rightsmanager.like=Liker
like.unlike.modal.title=Bekreft "liker ikke"
like.unlike.modal.body=Er du sikker på at du ønsker å fjerne din "Liker" for side {0}?
like.unlike.modal.closeButton=Lukk
like.unlike.modal.unlikeButton=Slutt å like siden
like.unlike.modal.viewLikersButton=Liker
like.newlike.success=Siden er blitt likt.
like.newlike.error=Feil når du prøver å like siden.
like.unlike.success=Siden er ikke lenger likt.
like.unlike.error=Feil under fjerning av liker.
like.userprofile.menu=Likte sider
like.button.title=Antall liker på denne siden: {0}
like.button.title.like=Klikk for å like siden. Antall likes på denne siden: {0}.
like.button.title.unlike=Klikk for å slutte å like siden. Antall liker på denne siden: {0}.
like.likers.empty=Ingen liker denne siden ennå.
like.likers.number={0} person(er) liker denne siden:
like.likers.title=Liker på {0}
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton=Vis alltid Liker-knappen
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton.hint=Vis knappen selv om brukeren ikke har rettigheter til å bruke den. Bruk hvis du alltid vil vise Liker-telleren.
XWiki.Like.LikeConfigurationClass_cacheCapacity=Hurtigbufferkapasitet
XWiki.Like.LikeConfigurationClass_cacheCapacity.hint=Antall Liker-informasjon som er lagret i hurtigbufferen. Merk at du må starte XWiki på nytt for at dette valget skal aktiveres.</content>

</xwikidoc>

## 内容10
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/LikeTranslations.ru.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.LikeTranslations" locale="ru">
  <web>XWiki.Like</web>
  <name>LikeTranslations</name>
  <language>ru</language>
  <defaultLanguage>en</defaultLanguage>
  <translation>1</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>Main.WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title>LikeTranslations</title>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>plain/1.0</syntaxId>
  <hidden>true</hidden>
  <content>rightsmanager.like=Нравиться
like.unlike.modal.title=Не нравиться?
like.unlike.modal.body=Вы действительно хотите удалить отметку "Нравится" для страницы {0}?
like.unlike.modal.closeButton=Закрыть
like.unlike.modal.unlikeButton=Не нравиться
like.unlike.modal.viewLikersButton=Просмотреть отметки "Нравиться"
like.newlike.success=Страничка понравилась.
like.newlike.error=Ошибка при попытке поставить "Нравиться" странице.
### Missing: like.unlike.success=The page has been unliked.
### Missing: like.unlike.error=Error when trying to unlike the page.
### Missing: like.userprofile.menu=Liked Pages
### Missing: like.button.title=Number of likes on this page: {0}
### Missing: like.button.title.like=Click to like the current page. Number of likes on this page: {0}.
### Missing: like.button.title.unlike=Click to unlike the current page. Number of likes on this page: {0}.
### Missing: like.likers.empty=No one likes this page yet.
### Missing: like.likers.number={0} person(s) like this page:
### Missing: like.likers.title=Likes on {0}
### Missing: XWiki.Like.LikeConfigurationClass_alwaysDisplayButton=Always display Like button
### Missing: XWiki.Like.LikeConfigurationClass_alwaysDisplayButton.hint=Display the button even if the user doesn't have the rights to interact with it. Use it if you wish to always display the Likes counter.
### Missing: XWiki.Like.LikeConfigurationClass_cacheCapacity=Cache capacity
### Missing: XWiki.Like.LikeConfigurationClass_cacheCapacity.hint=Number of Like information kept in cache. Note that you have to restart XWiki for this option change to be taken into account.</content>

</xwikidoc>

## 内容11
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/LikeTranslations.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.LikeTranslations" locale="">
  <web>XWiki.Like</web>
  <name>LikeTranslations</name>
  <language/>
  <defaultLanguage>en</defaultLanguage>
  <translation>0</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>Main.WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title>LikeTranslations</title>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>plain/1.0</syntaxId>
  <hidden>true</hidden>
  <content>rightsmanager.like=Like
like.unlike.modal.title=Unlike confirmation
like.unlike.modal.body=Are you sure you wish to remove your Like for page {0}?
like.unlike.modal.closeButton=Close
like.unlike.modal.unlikeButton=Unlike the page
like.unlike.modal.viewLikersButton=Likes
like.newlike.success=The page has been liked.
like.newlike.error=Error when trying to like the page.
like.unlike.success=The page has been unliked.
like.unlike.error=Error when trying to unlike the page.
like.userprofile.menu=Liked Pages
like.button.title=Number of likes on this page: {0}
like.button.title.like=Click to like the current page. Number of likes on this page: {0}.
like.button.title.unlike=Click to unlike the current page. Number of likes on this page: {0}.
like.likers.empty=No one likes this page yet.
like.likers.number={0} person(s) like this page:
like.likers.title=Likes on {0}
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton=Always display Like button
XWiki.Like.LikeConfigurationClass_alwaysDisplayButton.hint=Display the button even if the user doesn't have the rights to interact with it. Use it if you wish to always display the Likes counter.
XWiki.Like.LikeConfigurationClass_cacheCapacity=Cache capacity
XWiki.Like.LikeConfigurationClass_cacheCapacity.hint=Number of Like information kept in cache. Note that you have to restart XWiki for this option change to be taken into account.</content>
  <object>
    <name>XWiki.Like.LikeTranslations</name>
    <number>0</number>
    <className>XWiki.TranslationDocumentClass</className>
    <guid>a2b32a08-d4a4-4004-b7d7-cd16324914d8</guid>
    <class>
      <name>XWiki.TranslationDocumentClass</name>
      <customClass/>
      <customMapping/>
      <defaultViewSheet/>
      <defaultEditSheet/>
      <defaultWeb/>
      <nameField/>
      <validationScript/>
      <scope>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <freeText>forbidden</freeText>
        <largeStorage>0</largeStorage>
        <multiSelect>0</multiSelect>
        <name>scope</name>
        <number>1</number>
        <prettyName>Scope</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators>|, </separators>
        <size>1</size>
        <unmodifiable>0</unmodifiable>
        <values>GLOBAL|WIKI|USER|ON_DEMAND</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </scope>
    </class>
    <property>
      <scope>WIKI</scope>
    </property>
  </object>
</xwikidoc>

## 内容12
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/LikeViewersMenuUIX.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.LikeViewersMenuUIX" locale="">
  <web>XWiki.Like</web>
  <name>LikeViewersMenuUIX</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title>LikeViewersMenuUIX</title>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.1</syntaxId>
  <hidden>true</hidden>
  <content/>
  <object>
    <name>XWiki.Like.LikeViewersMenuUIX</name>
    <number>0</number>
    <className>XWiki.UIExtensionClass</className>
    <guid>dc089545-5795-45e7-92f0-7cc28d1c74f5</guid>
    <class>
      <name>XWiki.UIExtensionClass</name>
      <customClass/>
      <customMapping/>
      <defaultViewSheet/>
      <defaultEditSheet/>
      <defaultWeb/>
      <nameField/>
      <validationScript/>
      <async_cached>
        <defaultValue>0</defaultValue>
        <disabled>0</disabled>
        <displayFormType>select</displayFormType>
        <displayType/>
        <name>async_cached</name>
        <number>3</number>
        <prettyName>Cached</prettyName>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
      </async_cached>
      <async_context>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <freeText>forbidden</freeText>
        <largeStorage>0</largeStorage>
        <multiSelect>1</multiSelect>
        <name>async_context</name>
        <number>4</number>
        <prettyName>Context elements</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators>|, </separators>
        <size>5</size>
        <unmodifiable>0</unmodifiable>
        <values>doc.reference=Document|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </async_context>
      <async_enabled>
        <defaultValue>0</defaultValue>
        <disabled>0</disabled>
        <displayFormType>select</displayFormType>
        <displayType/>
        <name>async_enabled</name>
        <number>2</number>
        <prettyName>Asynchronous rendering</prettyName>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
      </async_enabled>
      <content>
        <disabled>0</disabled>
        <editor>Text</editor>
        <name>content</name>
        <number>1</number>
        <prettyName>Executed Content</prettyName>
        <rows>25</rows>
        <size>120</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
      </content>
      <extensionPointId>
        <disabled>0</disabled>
        <name>extensionPointId</name>
        <number>5</number>
        <prettyName>Extension Point ID</prettyName>
        <size>30</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.StringClass</classType>
      </extensionPointId>
      <name>
        <disabled>0</disabled>
        <name>name</name>
        <number>6</number>
        <prettyName>Extension ID</prettyName>
        <size>30</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.StringClass</classType>
      </name>
      <parameters>
        <contenttype>PureText</contenttype>
        <disabled>0</disabled>
        <editor>PureText</editor>
        <name>parameters</name>
        <number>7</number>
        <prettyName>Extension Parameters</prettyName>
        <rows>10</rows>
        <size>40</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
      </parameters>
      <scope>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <freeText>forbidden</freeText>
        <largeStorage>0</largeStorage>
        <multiSelect>0</multiSelect>
        <name>scope</name>
        <number>8</number>
        <prettyName>Extension Scope</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators>|, </separators>
        <size>1</size>
        <unmodifiable>0</unmodifiable>
        <values>wiki=Current Wiki|user=Current User|global=Global</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </scope>
    </class>
    <property>
      <async_cached>1</async_cached>
    </property>
    <property>
      <async_context>
        <value>doc.reference</value>
      </async_context>
    </property>
    <property>
      <async_enabled>0</async_enabled>
    </property>
    <property>
      <content>{{velocity}}
        {{html clean="false"}}
        #template('menus_macros.vm')
        #submenuitem($doc.getURL('view','viewer=likers'), $services.localization.render('like.unlike.modal.viewLikersButton'), 'likers', '', 'heart')
        {{/html}}
        {{/velocity}}</content>
    </property>
    <property>
      <extensionPointId>org.xwiki.platform.template.menu.viewers</extensionPointId>
    </property>
    <property>
      <name>org.xwiki.like.menu.viewer</name>
    </property>
    <property>
      <parameters>order=120000</parameters>
    </property>
    <property>
      <scope>wiki</scope>
    </property>
  </object>
</xwikidoc>
## 内容13
### 文件路径：
xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-ui/src/main/resources/XWiki/Like/UserProfileUIX.xml
### 代码内容：
<?xml version="1.1" encoding="UTF-8"?>

<xwikidoc version="1.4" reference="XWiki.Like.UserProfileUIX" locale="">
  <web>XWiki.Like</web>
  <name>UserProfileUIX</name>
  <language/>
  <defaultLanguage/>
  <translation>0</translation>
  <creator>xwiki:XWiki.Admin</creator>
  <parent>XWiki.Like.WebHome</parent>
  <author>xwiki:XWiki.Admin</author>
  <contentAuthor>xwiki:XWiki.Admin</contentAuthor>
  <version>1.1</version>
  <title/>
  <comment/>
  <minorEdit>false</minorEdit>
  <syntaxId>xwiki/2.1</syntaxId>
  <hidden>true</hidden>
  <content/>
  <object>
    <name>XWiki.Like.UserProfileUIX</name>
    <number>0</number>
    <className>XWiki.UIExtensionClass</className>
    <guid>b79d80e9-7a28-4d56-b5d9-1de5cfa820ff</guid>
    <class>
      <name>XWiki.UIExtensionClass</name>
      <customClass/>
      <customMapping/>
      <defaultViewSheet/>
      <defaultEditSheet/>
      <defaultWeb/>
      <nameField/>
      <validationScript/>
      <async_cached>
        <defaultValue>0</defaultValue>
        <disabled>0</disabled>
        <displayFormType>select</displayFormType>
        <displayType/>
        <name>async_cached</name>
        <number>3</number>
        <prettyName>Cached</prettyName>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
      </async_cached>
      <async_context>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <multiSelect>1</multiSelect>
        <name>async_context</name>
        <number>4</number>
        <prettyName>Context elements</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator>, </separator>
        <separators>|, </separators>
        <size>5</size>
        <unmodifiable>0</unmodifiable>
        <values>doc.reference=Document|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </async_context>
      <async_enabled>
        <defaultValue>0</defaultValue>
        <disabled>0</disabled>
        <displayFormType>select</displayFormType>
        <displayType/>
        <name>async_enabled</name>
        <number>2</number>
        <prettyName>Asynchronous rendering</prettyName>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
      </async_enabled>
      <content>
        <disabled>0</disabled>
        <editor>Text</editor>
        <name>content</name>
        <number>1</number>
        <prettyName>Executed Content</prettyName>
        <rows>25</rows>
        <size>120</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
      </content>
      <extensionPointId>
        <disabled>0</disabled>
        <name>extensionPointId</name>
        <number>5</number>
        <prettyName>Extension Point ID</prettyName>
        <size>30</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.StringClass</classType>
      </extensionPointId>
      <name>
        <disabled>0</disabled>
        <name>name</name>
        <number>6</number>
        <prettyName>Extension ID</prettyName>
        <size>30</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.StringClass</classType>
      </name>
      <parameters>
        <contenttype>PureText</contenttype>
        <disabled>0</disabled>
        <editor>PureText</editor>
        <name>parameters</name>
        <number>7</number>
        <prettyName>Extension Parameters</prettyName>
        <rows>10</rows>
        <size>40</size>
        <unmodifiable>0</unmodifiable>
        <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
      </parameters>
      <scope>
        <cache>0</cache>
        <disabled>0</disabled>
        <displayType>select</displayType>
        <freeText>forbidden</freeText>
        <largeStorage>0</largeStorage>
        <multiSelect>0</multiSelect>
        <name>scope</name>
        <number>8</number>
        <prettyName>Extension Scope</prettyName>
        <relationalStorage>0</relationalStorage>
        <separator> </separator>
        <separators>|, </separators>
        <size>1</size>
        <unmodifiable>0</unmodifiable>
        <values>wiki=Current Wiki|user=Current User|global=Global</values>
        <classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
      </scope>
    </class>
    <property>
      <async_cached>0</async_cached>
    </property>
    <property>
      <async_context>
        <value>user</value>
        <value>wiki</value>
      </async_context>
    </property>
    <property>
      <async_enabled>1</async_enabled>
    </property>
    <property>
      <content>{{velocity}}
#set ($likedReferences = $services.like.getUserLikes($services.user.currentUserReference, 0, 50))
|=Page
#foreach ($likeReference in $likedReferences)
  #set ($likedDocument = $xwiki.getDocument($likeReference))
  |[[$likedDocument.title>>$services.model.serialize($likeReference)]]
#end
{{/velocity}}</content>
    </property>
    <property>
      <extensionPointId>org.xwiki.plaftorm.user.profile.menu</extensionPointId>
    </property>
    <property>
      <name>org.xwiki.platform.like.userProfileMenu</name>
    </property>
    <property>
      <parameters>icon=heart
name=$services.localization.render('like.userprofile.menu')
isActive=#if($services.like.isAuthorized($services.wiki.currentWikiReference))true#{else}false#end
priority=1000</parameters>
    </property>
    <property>
      <scope>wiki</scope>
    </property>
  </object>
</xwikidoc>

Output:
【漏洞类型】信息泄露漏洞
【严重性】Medium
【漏洞摘要】原始代码中，`likers.vm`和`UserProfileUIX.xml`模板文件存在未验证的用户输入，可能导致信息泄露漏洞。在`likers.vm`中，用户可以通过传递参数直接获取特定文档的点赞者信息，而无需进行身份验证或权限检查。在`UserProfileUIX.xml`中，用户profile页面展示了当前用户点赞的所有文档，但这些信息未进行适当的输入验证和权限控制，可能被未授权用户访问。
【关键代码模式】
- `likers.vm`中的行：`#set ($likers = $services.like.getLikers($doc, 0, 50))`
- `UserProfileUIX.xml`中的行：`#set ($likedReferences = $services.like.getUserLikes($services.user.currentUserReference, 0, 50))`
【修复方法说明】修复方法通过在`likers.vm`和`UserProfileUIX.xml`中添加身份验证和权限检查，解决了未验证的用户输入问题。