Add sboverride right to override the spam blacklist

Bug: T36928
Change-Id: I516dc68ec7a2dfaa82647feb67ec9bd264b8c380
This commit is contained in:
DannyS712 2019-11-23 02:45:58 +00:00 committed by DannyS712
parent cae88c4609
commit 2a66c6b06f
4 changed files with 26 additions and 9 deletions

View file

@ -18,7 +18,8 @@
}
},
"AvailableRights": [
"spamblacklistlog"
"spamblacklistlog",
"sboverride"
],
"LogTypes": [
"spamblacklist"

View file

@ -10,11 +10,13 @@
"spam-blacklisted-email-text": "Your email address is currently forbidden from sending emails to other users.",
"spam-blacklisted-email-signup": "The given email address is currently forbidden from use.",
"spam-blacklisted-link": "{{int:spamprotectiontext}}\n{{int:spamprotectionmatch|$1}}",
"spam-invalid-lines": "The following spam block list {{PLURAL:$1|line is an|lines are}} invalid regular {{PLURAL:$1|expression|expressions}} and {{PLURAL:$1|needs|need}} to be corrected before saving the page:",
"spam-blacklist-desc": "Regex-based anti-spam tool allowing to forbid URLs in pages and email addresses for registered users",
"log-name-spamblacklist": "Spam block list log",
"log-description-spamblacklist": "These events track spam block list hits.",
"logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam block list hit on $3 by attempting to add $4.",
"right-spamblacklistlog": "View the spam block list log",
"action-spamblacklistlog": "view the spam block list log"
"spam-invalid-lines": "The following spam blacklist {{PLURAL:$1|line is an|lines are}} invalid regular {{PLURAL:$1|expression|expressions}} and {{PLURAL:$1|needs|need}} to be corrected before saving the page:",
"spam-blacklist-desc": "Regex-based anti-spam tool allowing to blacklist URLs in pages and email addresses for registered users",
"log-name-spamblacklist": "Spam blacklist log",
"log-description-spamblacklist": "These events track spam blacklist hits.",
"logentry-spamblacklist-hit": "{{GENDER:$2|$1}} caused a spam blacklist hit on $3 by attempting to add $4.",
"right-spamblacklistlog": "View the spam blacklist log",
"action-spamblacklistlog": "view the spam blacklist log",
"right-sboverride": "Bypass the spam blacklist",
"action-sboverride": "Bypass the spam blacklist"
}

View file

@ -24,5 +24,7 @@
"log-description-spamblacklist": "Description of spam blacklist log",
"logentry-spamblacklist-hit": "Log entry that is created when a user adds a link that is forbidden by the spam blacklist.\n\n{{logentry}}\nAdditional parameters:\n* $4 - the URL the user tried to add",
"right-spamblacklistlog": "{{doc-right|spamblacklistlog}}",
"action-spamblacklistlog": "{{doc-action|spamblacklistlog}}"
"action-spamblacklistlog": "{{doc-action|spamblacklistlog}}",
"right-sboverride": "{{doc-right|sboverride}}",
"action-sboverride": "{{doc-action|sboverride}}"
}

View file

@ -61,6 +61,12 @@ class Hooks implements
User $user,
$minoredit
) {
if ( MediaWikiServices::getInstance()->getPermissionManager()
->userHasRight( $user, 'sboverride' )
) {
return true;
}
$title = $context->getTitle();
try {
// Try getting the update directly
@ -251,6 +257,12 @@ class Hooks implements
$pageText,
&$error
) {
if ( MediaWikiServices::getInstance()->getPermissionManager()
->userHasRight( $user, 'sboverride' )
) {
return;
}
$title = $upload->getTitle();
// get the link from the not-yet-saved page content.