2020-10-10 17:20:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\AbuseFilter;
|
|
|
|
|
2021-02-26 16:47:50 +00:00
|
|
|
use MediaWiki\Config\ServiceOptions;
|
2020-11-26 15:23:22 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\ChangeTags\ChangeTagValidator;
|
2020-10-10 17:20:21 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Filter\AbstractFilter;
|
2021-08-29 22:58:17 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Parser\Exception\UserVisibleException;
|
2021-09-01 11:53:38 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Parser\RuleCheckerFactory;
|
2021-06-05 05:06:22 +00:00
|
|
|
use MediaWiki\Permissions\Authority;
|
2023-12-10 19:03:19 +00:00
|
|
|
use MediaWiki\Status\Status;
|
2020-10-10 17:20:21 +00:00
|
|
|
use Message;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class validates filters, e.g. before saving.
|
|
|
|
*/
|
|
|
|
class FilterValidator {
|
|
|
|
public const SERVICE_NAME = 'AbuseFilterFilterValidator';
|
|
|
|
|
2021-02-26 16:47:50 +00:00
|
|
|
public const CONSTRUCTOR_OPTIONS = [
|
|
|
|
'AbuseFilterValidGroups',
|
2024-05-23 14:49:17 +00:00
|
|
|
'AbuseFilterActionRestrictions',
|
|
|
|
'AbuseFilterProtectedVariables',
|
2021-02-26 16:47:50 +00:00
|
|
|
];
|
|
|
|
|
2020-11-06 12:13:02 +00:00
|
|
|
/** @var ChangeTagValidator */
|
|
|
|
private $changeTagValidator;
|
2020-10-10 17:20:21 +00:00
|
|
|
|
2021-09-01 11:53:38 +00:00
|
|
|
/** @var RuleCheckerFactory */
|
|
|
|
private $ruleCheckerFactory;
|
2020-10-10 17:20:21 +00:00
|
|
|
|
|
|
|
/** @var AbuseFilterPermissionManager */
|
|
|
|
private $permManager;
|
|
|
|
|
|
|
|
/** @var string[] */
|
|
|
|
private $restrictedActions;
|
|
|
|
|
2021-02-26 16:47:50 +00:00
|
|
|
/** @var string[] */
|
|
|
|
private $validGroups;
|
|
|
|
|
2024-05-23 14:49:17 +00:00
|
|
|
/**
|
|
|
|
* @var string[] Protected variables defined in config via AbuseFilterProtectedVariables
|
|
|
|
*/
|
|
|
|
private $protectedVariables;
|
|
|
|
|
2020-10-10 17:20:21 +00:00
|
|
|
/**
|
2020-11-06 12:13:02 +00:00
|
|
|
* @param ChangeTagValidator $changeTagValidator
|
2021-09-01 11:53:38 +00:00
|
|
|
* @param RuleCheckerFactory $ruleCheckerFactory
|
2020-10-10 17:20:21 +00:00
|
|
|
* @param AbuseFilterPermissionManager $permManager
|
2021-02-26 16:47:50 +00:00
|
|
|
* @param ServiceOptions $options
|
2020-10-10 17:20:21 +00:00
|
|
|
*/
|
|
|
|
public function __construct(
|
2020-11-06 12:13:02 +00:00
|
|
|
ChangeTagValidator $changeTagValidator,
|
2021-09-01 11:53:38 +00:00
|
|
|
RuleCheckerFactory $ruleCheckerFactory,
|
2020-10-10 17:20:21 +00:00
|
|
|
AbuseFilterPermissionManager $permManager,
|
2021-02-26 16:47:50 +00:00
|
|
|
ServiceOptions $options
|
2020-10-10 17:20:21 +00:00
|
|
|
) {
|
2020-11-06 12:13:02 +00:00
|
|
|
$this->changeTagValidator = $changeTagValidator;
|
2021-09-01 11:53:38 +00:00
|
|
|
$this->ruleCheckerFactory = $ruleCheckerFactory;
|
2020-10-10 17:20:21 +00:00
|
|
|
$this->permManager = $permManager;
|
2021-02-26 16:47:50 +00:00
|
|
|
$this->restrictedActions = array_keys( array_filter( $options->get( 'AbuseFilterActionRestrictions' ) ) );
|
|
|
|
$this->validGroups = $options->get( 'AbuseFilterValidGroups' );
|
2024-05-23 14:49:17 +00:00
|
|
|
$this->protectedVariables = $options->get( 'AbuseFilterProtectedVariables' );
|
2020-10-10 17:20:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param AbstractFilter $newFilter
|
|
|
|
* @param AbstractFilter $originalFilter
|
2022-05-27 09:41:54 +00:00
|
|
|
* @param Authority $performer
|
2020-10-10 17:20:21 +00:00
|
|
|
* @return Status
|
|
|
|
*/
|
2022-05-27 09:41:54 +00:00
|
|
|
public function checkAll(
|
|
|
|
AbstractFilter $newFilter, AbstractFilter $originalFilter, Authority $performer
|
|
|
|
): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
// TODO We might consider not bailing at the first error, so we can show all errors at the first attempt
|
|
|
|
|
|
|
|
$syntaxStatus = $this->checkValidSyntax( $newFilter );
|
|
|
|
if ( !$syntaxStatus->isGood() ) {
|
|
|
|
return $syntaxStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
$requiredFieldsStatus = $this->checkRequiredFields( $newFilter );
|
|
|
|
if ( !$requiredFieldsStatus->isGood() ) {
|
|
|
|
return $requiredFieldsStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
$conflictStatus = $this->checkConflictingFields( $newFilter );
|
|
|
|
if ( !$conflictStatus->isGood() ) {
|
|
|
|
return $conflictStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
$actions = $newFilter->getActions();
|
|
|
|
if ( isset( $actions['tag'] ) ) {
|
|
|
|
$validTagsStatus = $this->checkAllTags( $actions['tag'] );
|
|
|
|
if ( !$validTagsStatus->isGood() ) {
|
|
|
|
return $validTagsStatus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$messagesStatus = $this->checkEmptyMessages( $newFilter );
|
|
|
|
if ( !$messagesStatus->isGood() ) {
|
|
|
|
return $messagesStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( isset( $actions['throttle'] ) ) {
|
|
|
|
$throttleStatus = $this->checkThrottleParameters( $actions['throttle'] );
|
|
|
|
if ( !$throttleStatus->isGood() ) {
|
|
|
|
return $throttleStatus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-23 14:49:17 +00:00
|
|
|
$protectedVarsPermissionStatus = $this->checkCanViewProtectedVariables( $performer, $newFilter );
|
|
|
|
if ( !$protectedVarsPermissionStatus->isGood() ) {
|
|
|
|
return $protectedVarsPermissionStatus;
|
|
|
|
}
|
|
|
|
|
2024-06-04 13:47:16 +00:00
|
|
|
$protectedVarsStatus = $this->checkProtectedVariables( $newFilter );
|
|
|
|
if ( !$protectedVarsStatus->isGood() ) {
|
|
|
|
return $protectedVarsStatus;
|
|
|
|
}
|
|
|
|
|
2022-05-27 09:41:54 +00:00
|
|
|
$globalPermStatus = $this->checkGlobalFilterEditPermission( $performer, $newFilter, $originalFilter );
|
2020-10-10 17:20:21 +00:00
|
|
|
if ( !$globalPermStatus->isGood() ) {
|
|
|
|
return $globalPermStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
$globalFilterMsgStatus = $this->checkMessagesOnGlobalFilters( $newFilter );
|
|
|
|
if ( !$globalFilterMsgStatus->isGood() ) {
|
|
|
|
return $globalFilterMsgStatus;
|
|
|
|
}
|
|
|
|
|
2022-05-27 09:41:54 +00:00
|
|
|
$restrictedActionsStatus = $this->checkRestrictedActions( $performer, $newFilter, $originalFilter );
|
2020-10-10 17:20:21 +00:00
|
|
|
if ( !$restrictedActionsStatus->isGood() ) {
|
|
|
|
return $restrictedActionsStatus;
|
|
|
|
}
|
|
|
|
|
2021-02-26 16:47:50 +00:00
|
|
|
$filterGroupStatus = $this->checkGroup( $newFilter );
|
|
|
|
if ( !$filterGroupStatus->isGood() ) {
|
|
|
|
return $filterGroupStatus;
|
|
|
|
}
|
|
|
|
|
2020-10-10 17:20:21 +00:00
|
|
|
return Status::newGood();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param AbstractFilter $filter
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkValidSyntax( AbstractFilter $filter ): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
$ret = Status::newGood();
|
2021-09-01 11:53:38 +00:00
|
|
|
$ruleChecker = $this->ruleCheckerFactory->newRuleChecker();
|
|
|
|
$syntaxStatus = $ruleChecker->checkSyntax( $filter->getRules() );
|
2021-09-06 20:40:36 +00:00
|
|
|
if ( !$syntaxStatus->isValid() ) {
|
2020-12-18 16:53:36 +00:00
|
|
|
$excep = $syntaxStatus->getException();
|
2021-08-29 22:58:17 +00:00
|
|
|
$errMsg = $excep instanceof UserVisibleException
|
2021-01-10 19:26:01 +00:00
|
|
|
? $excep->getMessageObj()
|
2020-12-18 16:53:36 +00:00
|
|
|
: $excep->getMessage();
|
|
|
|
$ret->error( 'abusefilter-edit-badsyntax', $errMsg );
|
2020-10-10 17:20:21 +00:00
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param AbstractFilter $filter
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkRequiredFields( AbstractFilter $filter ): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
$ret = Status::newGood();
|
|
|
|
$missing = [];
|
|
|
|
if ( $filter->getRules() === '' ) {
|
|
|
|
$missing[] = new Message( 'abusefilter-edit-field-conditions' );
|
|
|
|
}
|
|
|
|
if ( trim( $filter->getName() ) === '' ) {
|
|
|
|
$missing[] = new Message( 'abusefilter-edit-field-description' );
|
|
|
|
}
|
|
|
|
if ( count( $missing ) !== 0 ) {
|
|
|
|
$ret->error(
|
|
|
|
'abusefilter-edit-missingfields',
|
|
|
|
Message::listParam( $missing, 'comma' )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param AbstractFilter $filter
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkConflictingFields( AbstractFilter $filter ): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
$ret = Status::newGood();
|
|
|
|
// Don't allow setting as deleted an active filter
|
|
|
|
if ( $filter->isEnabled() && $filter->isDeleted() ) {
|
|
|
|
$ret->error( 'abusefilter-edit-deleting-enabled' );
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string[] $tags
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkAllTags( array $tags ): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
$ret = Status::newGood();
|
|
|
|
if ( count( $tags ) === 0 ) {
|
|
|
|
$ret->error( 'tags-create-no-name' );
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
foreach ( $tags as $tag ) {
|
2020-11-06 12:13:02 +00:00
|
|
|
$curStatus = $this->changeTagValidator->validateTag( $tag );
|
2020-10-10 17:20:21 +00:00
|
|
|
|
|
|
|
if ( !$curStatus->isGood() ) {
|
|
|
|
// TODO Consider merging
|
|
|
|
return $curStatus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @todo Consider merging with checkRequiredFields
|
|
|
|
* @param AbstractFilter $filter
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkEmptyMessages( AbstractFilter $filter ): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
$ret = Status::newGood();
|
|
|
|
$actions = $filter->getActions();
|
|
|
|
// TODO: Check and report both together
|
|
|
|
if ( isset( $actions['warn'] ) && $actions['warn'][0] === '' ) {
|
|
|
|
$ret->error( 'abusefilter-edit-invalid-warn-message' );
|
|
|
|
} elseif ( isset( $actions['disallow'] ) && $actions['disallow'][0] === '' ) {
|
|
|
|
$ret->error( 'abusefilter-edit-invalid-disallow-message' );
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validate throttle parameters
|
|
|
|
*
|
|
|
|
* @param array $params Throttle parameters
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkThrottleParameters( array $params ): Status {
|
2024-03-16 18:52:48 +00:00
|
|
|
[ $throttleCount, $throttlePeriod ] = explode( ',', $params[1], 2 );
|
2020-10-10 17:20:21 +00:00
|
|
|
$throttleGroups = array_slice( $params, 2 );
|
|
|
|
$validGroups = [
|
|
|
|
'ip',
|
|
|
|
'user',
|
|
|
|
'range',
|
|
|
|
'creationdate',
|
|
|
|
'editcount',
|
|
|
|
'site',
|
|
|
|
'page'
|
|
|
|
];
|
|
|
|
|
|
|
|
$ret = Status::newGood();
|
|
|
|
if ( preg_match( '/^[1-9][0-9]*$/', $throttleCount ) === 0 ) {
|
|
|
|
$ret->error( 'abusefilter-edit-invalid-throttlecount' );
|
|
|
|
} elseif ( preg_match( '/^[1-9][0-9]*$/', $throttlePeriod ) === 0 ) {
|
|
|
|
$ret->error( 'abusefilter-edit-invalid-throttleperiod' );
|
|
|
|
} elseif ( !$throttleGroups ) {
|
|
|
|
$ret->error( 'abusefilter-edit-empty-throttlegroups' );
|
|
|
|
} else {
|
|
|
|
$valid = true;
|
|
|
|
// Groups should be unique in three ways: no direct duplicates like 'user' and 'user',
|
|
|
|
// no duplicated subgroups, not even shuffled ('ip,user' and 'user,ip') and no duplicates
|
|
|
|
// within subgroups ('user,ip,user')
|
|
|
|
$uniqueGroups = [];
|
|
|
|
$uniqueSubGroups = true;
|
|
|
|
// Every group should be valid, and subgroups should have valid groups inside
|
|
|
|
foreach ( $throttleGroups as $group ) {
|
|
|
|
if ( strpos( $group, ',' ) !== false ) {
|
|
|
|
$subGroups = explode( ',', $group );
|
2021-12-05 01:32:07 +00:00
|
|
|
// @phan-suppress-next-line PhanPossiblyUndeclaredVariable
|
2020-10-10 17:20:21 +00:00
|
|
|
if ( $subGroups !== array_unique( $subGroups ) ) {
|
|
|
|
$uniqueSubGroups = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
foreach ( $subGroups as $subGroup ) {
|
|
|
|
if ( !in_array( $subGroup, $validGroups ) ) {
|
|
|
|
$valid = false;
|
|
|
|
break 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sort( $subGroups );
|
|
|
|
$uniqueGroups[] = implode( ',', $subGroups );
|
|
|
|
} else {
|
|
|
|
if ( !in_array( $group, $validGroups ) ) {
|
|
|
|
$valid = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$uniqueGroups[] = $group;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !$valid ) {
|
|
|
|
$ret->error( 'abusefilter-edit-invalid-throttlegroups' );
|
|
|
|
} elseif ( !$uniqueSubGroups || $uniqueGroups !== array_unique( $uniqueGroups ) ) {
|
|
|
|
$ret->error( 'abusefilter-edit-duplicated-throttlegroups' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-05-27 09:41:54 +00:00
|
|
|
* @param Authority $performer
|
2020-10-10 17:20:21 +00:00
|
|
|
* @param AbstractFilter $newFilter
|
|
|
|
* @param AbstractFilter $originalFilter
|
|
|
|
* @return Status
|
|
|
|
*/
|
|
|
|
public function checkGlobalFilterEditPermission(
|
2022-05-27 09:41:54 +00:00
|
|
|
Authority $performer,
|
2020-10-10 17:20:21 +00:00
|
|
|
AbstractFilter $newFilter,
|
|
|
|
AbstractFilter $originalFilter
|
2021-07-21 18:51:12 +00:00
|
|
|
): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
if (
|
2022-05-27 09:41:54 +00:00
|
|
|
!$this->permManager->canEditFilter( $performer, $newFilter ) ||
|
|
|
|
!$this->permManager->canEditFilter( $performer, $originalFilter )
|
2020-10-10 17:20:21 +00:00
|
|
|
) {
|
|
|
|
return Status::newFatal( 'abusefilter-edit-notallowed-global' );
|
|
|
|
}
|
|
|
|
return Status::newGood();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param AbstractFilter $filter
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkMessagesOnGlobalFilters( AbstractFilter $filter ): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
$ret = Status::newGood();
|
|
|
|
$actions = $filter->getActions();
|
|
|
|
if (
|
|
|
|
$filter->isGlobal() && (
|
|
|
|
( isset( $actions['warn'] ) && $actions['warn'][0] !== 'abusefilter-warning' ) ||
|
|
|
|
( isset( $actions['disallow'] ) && $actions['disallow'][0] !== 'abusefilter-disallowed' )
|
|
|
|
)
|
|
|
|
) {
|
|
|
|
$ret->error( 'abusefilter-edit-notallowed-global-custom-msg' );
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-06-05 05:06:22 +00:00
|
|
|
* @param Authority $performer
|
2020-10-10 17:20:21 +00:00
|
|
|
* @param AbstractFilter $newFilter
|
|
|
|
* @param AbstractFilter $originalFilter
|
|
|
|
* @return Status
|
|
|
|
*/
|
|
|
|
public function checkRestrictedActions(
|
2021-06-05 05:06:22 +00:00
|
|
|
Authority $performer,
|
2020-10-10 17:20:21 +00:00
|
|
|
AbstractFilter $newFilter,
|
|
|
|
AbstractFilter $originalFilter
|
2021-07-21 18:51:12 +00:00
|
|
|
): Status {
|
2020-10-10 17:20:21 +00:00
|
|
|
$ret = Status::newGood();
|
2021-07-10 07:57:12 +00:00
|
|
|
$allEnabledActions = $newFilter->getActions() + $originalFilter->getActions();
|
2020-10-10 17:20:21 +00:00
|
|
|
if (
|
2021-07-10 07:57:12 +00:00
|
|
|
array_intersect_key( array_fill_keys( $this->restrictedActions, true ), $allEnabledActions )
|
2021-06-05 05:06:22 +00:00
|
|
|
&& !$this->permManager->canEditFilterWithRestrictedActions( $performer )
|
2020-10-10 17:20:21 +00:00
|
|
|
) {
|
|
|
|
$ret->error( 'abusefilter-edit-restricted' );
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
2021-02-26 16:47:50 +00:00
|
|
|
|
2024-05-23 14:49:17 +00:00
|
|
|
/**
|
|
|
|
* @param AbstractFilter $filter
|
|
|
|
* @return Status
|
|
|
|
*/
|
2024-06-04 13:47:16 +00:00
|
|
|
public function checkProtectedVariables( AbstractFilter $filter ): Status {
|
2024-05-23 14:49:17 +00:00
|
|
|
$ret = Status::newGood();
|
|
|
|
$ruleChecker = $this->ruleCheckerFactory->newRuleChecker();
|
2024-06-04 13:47:16 +00:00
|
|
|
$usedVariables = (array)$ruleChecker->getUsedVars( $filter->getRules() );
|
|
|
|
$usedProtectedVariables = array_intersect( $usedVariables, $this->protectedVariables );
|
|
|
|
|
|
|
|
if (
|
|
|
|
count( $usedProtectedVariables ) > 0 &&
|
|
|
|
!$filter->isProtected()
|
|
|
|
) {
|
|
|
|
$ret->error(
|
|
|
|
'abusefilter-edit-protected-variable-not-protected',
|
|
|
|
Message::listParam( $usedProtectedVariables )
|
|
|
|
);
|
2024-05-23 14:49:17 +00:00
|
|
|
}
|
2024-06-04 13:47:16 +00:00
|
|
|
|
2024-05-23 14:49:17 +00:00
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-06-04 13:47:16 +00:00
|
|
|
* @param Authority $performer
|
2024-05-23 14:49:17 +00:00
|
|
|
* @param AbstractFilter $filter
|
2024-06-04 13:47:16 +00:00
|
|
|
* @return Status
|
2024-05-23 14:49:17 +00:00
|
|
|
*/
|
2024-06-04 13:47:16 +00:00
|
|
|
public function checkCanViewProtectedVariables( Authority $performer, AbstractFilter $filter ): Status {
|
|
|
|
$ret = Status::newGood();
|
2024-05-23 14:49:17 +00:00
|
|
|
$ruleChecker = $this->ruleCheckerFactory->newRuleChecker();
|
2024-06-04 13:47:16 +00:00
|
|
|
$usedVars = $ruleChecker->getUsedVars( $filter->getRules() );
|
|
|
|
$missingRights = $this->permManager->shouldProtectFilter( $performer, $usedVars );
|
|
|
|
if ( is_array( $missingRights ) ) {
|
|
|
|
$ret->error( 'abusefilter-edit-protected-variable', Message::listParam( $missingRights ) );
|
|
|
|
}
|
|
|
|
return $ret;
|
2024-05-23 14:49:17 +00:00
|
|
|
}
|
|
|
|
|
2021-02-26 16:47:50 +00:00
|
|
|
/**
|
|
|
|
* @param AbstractFilter $filter
|
|
|
|
* @return Status
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function checkGroup( AbstractFilter $filter ): Status {
|
2021-02-26 16:47:50 +00:00
|
|
|
$ret = Status::newGood();
|
|
|
|
$group = $filter->getGroup();
|
|
|
|
if ( !in_array( $group, $this->validGroups, true ) ) {
|
|
|
|
$ret->error( 'abusefilter-edit-invalid-group' );
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
2020-10-10 17:20:21 +00:00
|
|
|
}
|