public function testPermissions() { $user = TranslateSandbox::addUser('Test user7', '*****@*****.**', 'test password'); $title = Title::makeTitle(NS_USER_TALK, $user->getName()); $this->assertFalse($title->userCan('edit', $user), 'Sandboxed users cannot edit their own talk page'); TranslateSandbox::promoteUser($user); $this->assertTrue($title->userCan('edit', $user), 'Promoted users can edit their own talk page'); }
protected function doPromote() { if (!$this->getUser()->isAllowed('translate-sandboxmanage')) { $this->dieUsage('Access denied', 'missingperms'); } $params = $this->extractRequestParams(); foreach ($params['userid'] as $user) { $user = User::newFromId($user); try { TranslateSandbox::promoteUser($user); } catch (MWException $e) { $this->dieUsage($e->getMessage(), 'invalidparam'); } TranslateSandbox::sendEmail($this->getUser(), $user, 'promotion'); $logEntry = new ManualLogEntry('translatorsandbox', 'promoted'); $logEntry->setPerformer($this->getUser()); $logEntry->setTarget($user->getUserPage()); $logEntry->setParameters(array('4::userid' => $user->getId())); $logid = $logEntry->insert(); $logEntry->publish($logid); $user->addNewUserLogEntry('tsbpromoted'); $this->createUserPage($user); Hooks::run('AddNewAccount', array($user, false)); } }