X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiProtect.php;h=d28906069fc0b066053c7c488227d9be3d2f1055;hb=ce3a2f56216256aa22d709e810107c592655034b;hp=f1c01210dc07f01488c92c7626b87f2ea8b7ecf1;hpb=f9d7d3b8561dab3ddfd8798a77a5b72e03ac8c2b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index f1c01210dc..d28906069f 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -42,6 +42,17 @@ class ApiProtect extends ApiBase { $this->dieUsageMsg( reset( $errors ) ); } + $user = $this->getUser(); + $tags = $params['tags']; + + // Check if user can add tags + if ( !is_null( $tags ) ) { + $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $tags, $user ); + if ( !$ableToTag->isOK() ) { + $this->dieStatus( $ableToTag ); + } + } + $expiry = (array)$params['expiry']; if ( count( $expiry ) != count( $params['protections'] ) ) { if ( count( $expiry ) == 1 ) { @@ -108,7 +119,8 @@ class ApiProtect extends ApiBase { $expiryarray, $cascade, $params['reason'], - $this->getUser() + $user, + $tags ); if ( !$status->isOK() ) { @@ -153,6 +165,10 @@ class ApiProtect extends ApiBase { ApiBase::PARAM_DFLT => 'infinite', ], 'reason' => '', + 'tags' => [ + ApiBase::PARAM_TYPE => 'tags', + ApiBase::PARAM_ISMULTI => true, + ], 'cascade' => false, 'watch' => [ ApiBase::PARAM_DFLT => false,