Permalink
Show file tree
Hide file tree
9 changes: 9 additions & 0 deletions
9
.../src/main/java/org/xwiki/localization/wiki/internal/DocumentTranslationBundleFactory.java
160 changes: 115 additions & 45 deletions
160
.../test/java/org/xwiki/localization/wiki/internal/DocumentTranslationBundleFactoryTest.java
10 changes: 10 additions & 0 deletions
10
...-tools/xwiki-platform-tool-configuration-resources/src/main/resources/xwiki.properties.vm
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
XWIKI-19749: Require script right for translations with user scope
* Add a new configuration option. * Migrate tests to JUnit 5 and add a new test.
- Loading branch information
Showing
6 changed files
with
224 additions
and
45 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...c/main/java/org/xwiki/localization/wiki/internal/DefaultWikiTranslationConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * 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.localization.wiki.internal; | ||
|
|
||
| import javax.inject.Inject; | ||
| import javax.inject.Named; | ||
| import javax.inject.Singleton; | ||
|
|
||
| import org.xwiki.component.annotation.Component; | ||
| import org.xwiki.configuration.ConfigurationSource; | ||
|
|
||
| /** | ||
| * Default implementation of the {@link WikiTranslationConfiguration}. | ||
| * | ||
| * @since 14.10.2 | ||
| * @since 15.0RC1 | ||
| * @version $Id$ | ||
| */ | ||
| @Singleton | ||
| @Component | ||
| public class DefaultWikiTranslationConfiguration implements WikiTranslationConfiguration | ||
| { | ||
| private static final String PREFIX = "localization.wiki."; | ||
|
|
||
| @Inject | ||
| @Named("xwikiproperties") | ||
| private ConfigurationSource configuration; | ||
|
|
||
| @Override | ||
| public boolean isRestrictUserTranslations() | ||
| { | ||
| return this.configuration.getProperty(PREFIX + "restrictUserTranslations", true); | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...wiki/src/main/java/org/xwiki/localization/wiki/internal/WikiTranslationConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * 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.localization.wiki.internal; | ||
|
|
||
| import org.xwiki.component.annotation.Role; | ||
|
|
||
| /** | ||
| * Configuration of the wiki translations. | ||
| * | ||
| * @since 14.10.2 | ||
| * @since 15.0RC1 | ||
| * @version $Id$ | ||
| */ | ||
| @Role | ||
| public interface WikiTranslationConfiguration | ||
| { | ||
| /** | ||
| * @return if translations with user scope shall be restricted to users with script right | ||
| */ | ||
| boolean isRestrictUserTranslations(); | ||
| } |
1 change: 1 addition & 0 deletions
1
...ources/xwiki-platform-localization-source-wiki/src/main/resources/META-INF/components.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| org.xwiki.localization.wiki.internal.DefaultWikiTranslationConfiguration | ||
| org.xwiki.localization.wiki.internal.DocumentTranslationBundleFactory | ||
| org.xwiki.localization.wiki.internal.DocumentTranslationBundleInitializer | ||
| org.xwiki.localization.wiki.internal.TranslationDocumentClassInitializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters