Timboven has uploaded a new change for review.
https://gerrit.wikimedia.org/r/61186
Change subject: Added extra condition types to secure pages: by Title
(exact/regex/startsWith)
......................................................................
Added extra condition types to secure pages: by Title (exact/regex/startsWith)
Change-Id: I8bcf96719b99141738f6abe103c4830d2e8a55c9
---
M SimpleSecurity_body.php
1 file changed, 16 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SimpleSecurity
refs/changes/86/61186/1
diff --git a/SimpleSecurity_body.php b/SimpleSecurity_body.php
index e345948..8ac5731 100644
--- a/SimpleSecurity_body.php
+++ b/SimpleSecurity_body.php
@@ -338,6 +338,15 @@
case "Namespace":
$deny = $data == $title->getNsText();
break;
+ case "Title":
+ $deny =
$this->startsWith($title->getFullText(), $data);
+ break;
+ case "TitleRegEx":
+ $deny = preg_match("/".$data."/i",
$title->getFullText());
+ break;
+ case "TitleEq":
+ $deny = $data == $title->getFullText();
+ break;
}
# If the rule applies to this title, check if we're a
member of the required groups,
@@ -362,6 +371,13 @@
}
}
+ private function startsWith($haystack, $needle, $case = true) {
+ if ($case) {
+ return strpos($haystack, $needle, 0) === 0;
+ }
+ return stripos($haystack, $needle, 0) === 0;
+ }
+
/**
* Create the new Database class with hooks in its query() and
fetchObject() methods and use our LBFactory_SimpleSecurity class
*/
--
To view, visit https://gerrit.wikimedia.org/r/61186
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bcf96719b99141738f6abe103c4830d2e8a55c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SimpleSecurity
Gerrit-Branch: master
Gerrit-Owner: Timboven <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits