Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/170693
Change subject: Adjust getPermissionForTitle method to getEditPermissionForTitle
......................................................................
Adjust getPermissionForTitle method to getEditPermissionForTitle
Change-Id: I4a376dcc14f195c86cae20ebdd00719c437c7002
---
M repo/includes/actions/ViewEntityAction.php
M repo/includes/content/EntityContentFactory.php
M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
3 files changed, 6 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/93/170693/1
diff --git a/repo/includes/actions/ViewEntityAction.php
b/repo/includes/actions/ViewEntityAction.php
index e814904..d65e40c 100644
--- a/repo/includes/actions/ViewEntityAction.php
+++ b/repo/includes/actions/ViewEntityAction.php
@@ -163,11 +163,10 @@
if ( $editable && !$content->isRedirect() ) {
$permissionChecker = $this->getPermissionChecker();
- $editable = $permissionChecker->getPermissionForTitle(
+ $editable =
$permissionChecker->getEditPermissionForTitle(
$this->getArticle()->getTitle(),
$content,
- $this->getUser(),
- 'edit'
+ $this->getUser()
);
}
diff --git a/repo/includes/content/EntityContentFactory.php
b/repo/includes/content/EntityContentFactory.php
index d666c97..d96bf3b 100644
--- a/repo/includes/content/EntityContentFactory.php
+++ b/repo/includes/content/EntityContentFactory.php
@@ -326,18 +326,17 @@
/**
* @param Title $title
* @param User $user
- * @param string $permission
*
* @return boolean
*/
- public function getPermissionForTitle( Title $title, EntityContent
$content, User $user, $permission ) {
+ public function getEditPermissionForTitle( Title $title, EntityContent
$content, User $user ) {
$entityContentTitle = $this->getTitleForId(
$content->getEntity()->getId() );
if ( $entityContentTitle->getFullText() !==
$title->getFullText() ) {
throw new MWException( '$title does not match content'
);
}
- $errors = $title->getUserPermissionsErrors( $permission, $user,
'quick' );
+ $errors = $title->getUserPermissionsErrors( 'edit', $user,
'quick' );
$permissionStatus = $this->getStatusForPermissionErrors(
$errors );
return $permissionStatus->isOK();
diff --git a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
index e18755a..40f4c2b 100644
--- a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
+++ b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
@@ -151,7 +151,7 @@
'getPermissionStatusForEntity' => true,
'getPermissionStatusForEntityType' =>
true,
'getPermissionStatusForEntityId' =>
true,
- 'getPermissionForTitle' => true,
+ 'getEditPermissionForTitle' => true,
),
),
'edit not allowed' => array(
@@ -162,7 +162,7 @@
'getPermissionStatusForEntity' => false,
'getPermissionStatusForEntityType' =>
false,
'getPermissionStatusForEntityId' =>
false,
- 'getPermissionForTitle' => false,
+ 'getEditPermissionForTitle' => false,
),
),
'delete not allowed' => array(
--
To view, visit https://gerrit.wikimedia.org/r/170693
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a376dcc14f195c86cae20ebdd00719c437c7002
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits