X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBotPasswords.php;h=2d3a0ccbb5ab5affef4638366a6c7d9eb5945bd4;hp=7b2d1bcbfdc5b64c918a0cb7e45a98a9635de76d;hb=23b7f3bbd553183a21d785bae175249efad5ee5d;hpb=cfd378774ec1eff28db481e40d33b56d32121020 diff --git a/includes/specials/SpecialBotPasswords.php b/includes/specials/SpecialBotPasswords.php index 7b2d1bcbfd..2d3a0ccbb5 100644 --- a/includes/specials/SpecialBotPasswords.php +++ b/includes/specials/SpecialBotPasswords.php @@ -21,6 +21,8 @@ * @ingroup SpecialPage */ +use MediaWiki\Logger\LoggerFactory; + /** * Let users manage bot passwords * @@ -40,8 +42,12 @@ class SpecialBotPasswords extends FormSpecialPage { /** @var string New password set, for communication between onSubmit() and onSuccess() */ private $password = null; + /** @var Psr\Log\LoggerInterface */ + private $logger = null; + public function __construct() { parent::__construct( 'BotPasswords', 'editmyprivateinfo' ); + $this->logger = LoggerFactory::getInstance( 'authentication' ); } /** @@ -51,6 +57,10 @@ class SpecialBotPasswords extends FormSpecialPage { return $this->getConfig()->get( 'EnableBotPasswords' ); } + protected function getLoginSecurityLevel() { + return $this->getName(); + } + /** * Main execution point * @param string|null $par @@ -277,6 +287,16 @@ class SpecialBotPasswords extends FormSpecialPage { $bp = BotPassword::newFromCentralId( $this->userId, $this->par ); if ( $bp ) { $bp->delete(); + $this->logger->info( + "Bot password {op} for {user}@{app_id}", + [ + 'app_id' => $this->par, + 'user' => $this->getUser()->getName(), + 'centralId' => $this->userId, + 'op' => 'delete', + 'client_ip' => $this->getRequest()->getIP() + ] + ); } return Status::newGood(); @@ -309,6 +329,18 @@ class SpecialBotPasswords extends FormSpecialPage { } if ( $bp->save( $this->operation, $password ) ) { + $this->logger->info( + "Bot password {op} for {user}@{app_id}", + [ + 'op' => $this->operation, + 'user' => $this->getUser()->getName(), + 'app_id' => $this->par, + 'centralId' => $this->userId, + 'restrictions' => $data['restrictions'], + 'grants' => $bp->getGrants(), + 'client_ip' => $this->getRequest()->getIP() + ] + ); return Status::newGood(); } else { // Messages: botpasswords-insert-failed, botpasswords-update-failed