jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403712 )

Change subject: Utilize disabled access for entity types as a config variable
......................................................................


Utilize disabled access for entity types as a config variable

This needs to be merged only after
https://github.com/wmde/WikibaseDataModelServices/pull/187
gets merged and released

Bug: T178904
Change-Id: I80fff20ec6685edd147eafe4e738d1a93c08cbc9
---
M client/config/WikibaseClient.default.php
M client/includes/DataAccess/ParserFunctions/LanguageAwareRenderer.php
M client/includes/WikibaseClient.php
M composer.json
M docs/options.wiki
5 files changed, 15 insertions(+), 5 deletions(-)

Approvals:
  WMDE-leszek: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/client/config/WikibaseClient.default.php 
b/client/config/WikibaseClient.default.php
index 312edac..7bd4b52 100644
--- a/client/config/WikibaseClient.default.php
+++ b/client/config/WikibaseClient.default.php
@@ -241,5 +241,8 @@
        // Enable reading of term_full_entity_id column in wb_terms table.
        $defaults['readFullEntityIdColumn'] = false;
 
+       // Disabled entity access
+       $defaults['disabledAccessEntityTypes'] = [];
+
        return $defaults;
 } );
diff --git 
a/client/includes/DataAccess/ParserFunctions/LanguageAwareRenderer.php 
b/client/includes/DataAccess/ParserFunctions/LanguageAwareRenderer.php
index bdfe320..387bd70 100644
--- a/client/includes/DataAccess/ParserFunctions/LanguageAwareRenderer.php
+++ b/client/includes/DataAccess/ParserFunctions/LanguageAwareRenderer.php
@@ -10,7 +10,7 @@
 use Wikibase\Client\DataAccess\StatementTransclusionInteractor;
 use Wikibase\Client\PropertyLabelNotResolvedException;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\DataModel\Services\Lookup\EntityAccessLimitException;
+use Wikibase\DataModel\Services\Lookup\EntityLookupException;
 
 /**
  * StatementGroupRenderer of the {{#property}} parser function.
@@ -66,11 +66,12 @@
                                )
                        );
                } catch ( PropertyLabelNotResolvedException $ex ) {
-                       $this->parserOutput->addTrackingCategory( 
'unresolved-property-category', $this->title );
+                       $this->parserOutput->addTrackingCategory( 
'unresolved-property-category',
+                               $this->title );
 
                        // @fixme use ExceptionLocalizer
                        $status = $this->getStatusForException( 
$propertyLabelOrId, $ex->getMessage() );
-               } catch ( EntityAccessLimitException $ex ) {
+               } catch ( EntityLookupException $ex ) {
                        $status = $this->getStatusForException( 
$propertyLabelOrId, $ex->getMessage() );
                } catch ( InvalidArgumentException $ex ) {
                        $status = $this->getStatusForException( 
$propertyLabelOrId, $ex->getMessage() );
diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index c433758..02590eb 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -56,6 +56,7 @@
 use Wikibase\DataModel\SerializerFactory;
 use Wikibase\DataModel\Services\Diff\EntityDiffer;
 use Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser;
+use Wikibase\DataModel\Services\Lookup\DisabledEntityTypesEntityLookup;
 use Wikibase\DataModel\Services\Lookup\EntityLookup;
 use Wikibase\DataModel\Services\Lookup\EntityRetrievingDataTypeLookup;
 use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup;
@@ -1202,8 +1203,12 @@
         */
        public function getRestrictedEntityLookup() {
                if ( $this->restrictedEntityLookup === null ) {
-                       $this->restrictedEntityLookup = new 
RestrictedEntityLookup(
+                       $disabledEntityTypesEntityLookup = new 
DisabledEntityTypesEntityLookup(
                                $this->getEntityLookup(),
+                               $this->settings->getSetting( 
'disabledAccessEntityTypes' )
+                       );
+                       $this->restrictedEntityLookup = new 
RestrictedEntityLookup(
+                               $disabledEntityTypesEntityLookup,
                                $this->settings->getSetting( 
'entityAccessLimit' )
                        );
                }
diff --git a/composer.json b/composer.json
index 9816a07..eea9306 100644
--- a/composer.json
+++ b/composer.json
@@ -33,7 +33,7 @@
                "wikibase/data-model": "^7.3.0",
                "wikibase/data-model-serialization": "^2.5.0",
                "wikibase/internal-serialization": "^2.2.0",
-               "wikibase/data-model-services": "^3.7.0",
+               "wikibase/data-model-services": "^3.9.0",
                "diff/diff": "^2.0.0",
                "wikimedia/purtle": "^1.0.6"
        },
diff --git a/docs/options.wiki b/docs/options.wiki
index fee5d1e..3ecfdf0 100644
--- a/docs/options.wiki
+++ b/docs/options.wiki
@@ -111,6 +111,7 @@
 ;badgeClassNames: A list of additional CSS class names for site links that 
have badges. The array has to consist of serialized item IDs pointing to their 
CSS class names, like <code>array( 'Q101' => 'badge-goodarticle' )</code>. Note 
that this extension does not add any CSS to actually display the badges.
 ;otherProjectsLinks: Site global ID list of sites which should be linked in 
the other projects sidebar section. Empty value will suppress this section.
 ;propertyOrderUrl: URL to use for retrieving the property order used for 
sorting properties by property ID. Will be ignored if set to null.
+;disabledAccessEntityTypes: List of entity types that access to them in the 
client should be disabled.
 
 === Expert Settings ===
 

-- 
To view, visit https://gerrit.wikimedia.org/r/403712
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I80fff20ec6685edd147eafe4e738d1a93c08cbc9
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <thiemo.kr...@wikimedia.de>
Gerrit-Reviewer: WMDE-leszek <leszek.mani...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to