public function execute() { $globalUser = new CentralAuthUser($this->getParameter('user')); if (!$this->getUser()->isAllowed('centralauth-lock')) { $this->dieUsageMsg(array('badaccess-groups')); } elseif (!$globalUser->exists()) { $this->dieUsageMsg(array('nosuchuser', $globalUser->getName())); } elseif ($globalUser->isOversighted() && !$this->getUser()->isAllowed('centralauth-oversight')) { $this->dieUsageMsg(array('nosuchuser', $globalUser->getName())); } elseif (!$this->getRequest()->getCheck('locked') && $this->getParameter('hidden') === null) { $this->dieUsage("At least one of the parameters locked, hidden is required", "missingparam"); } $setLocked = $this->getParameter('locked'); if (!$setLocked) { // Don't lock or unlock $setLocked = null; } else { $setLocked = $setLocked === 'lock'; } $setHidden = $this->getParameter('hidden'); $reason = $this->getParameter('reason'); $stateCheck = $this->getParameter('statecheck'); if ($stateCheck && $stateCheck !== $globalUser->getStateHash(true)) { $this->dieUsage('Edit conflict detected, Aborting.', 'editconflict'); } $status = $globalUser->adminLockHide($setLocked, $setHidden, $reason, $this->getContext()); // Logging etc if ($status->isGood()) { $this->getResult()->addValue(null, $this->getModuleName(), array('user' => $globalUser->getName(), 'locked' => $globalUser->isLocked(), 'hidden' => $globalUser->getHiddenLevel(), 'reason' => $reason)); } else { if (is_callable(array($this, 'getErrorFormatter'))) { $error = $this->getErrorFormatter()->arrayFromStatus($status); } else { $error = $this->getResult()->convertStatusToArray($status); } $this->getResult()->addValue('error', null, $error); $this->getResult()->addValue(null, $this->getModuleName(), array('user' => $globalUser->getName(), 'locked' => $globalUser->isLocked(), 'hidden' => $globalUser->getHiddenLevel())); } }