/**
  * Checks that the user is in the sandbox. Also handles special overrides
  * mainly used for integration testing.
  *
  * @return bool
  */
 protected function hasPermissionToUse()
 {
     global $wgTranslateTestUsers;
     $request = $this->getRequest();
     $user = $this->getUser();
     if (in_array($user->getName(), $wgTranslateTestUsers, true)) {
         if ($request->getVal('integrationtesting') === 'activatestash') {
             $user->addGroup('translate-sandboxed');
             return true;
         } elseif ($request->getVal('integrationtesting') === 'deactivatestash') {
             $user->removeGroup('translate-sandboxed');
             $this->stash->deleteTranslations($user);
             return false;
         }
     }
     if (!TranslateSandbox::isSandboxed($user)) {
         return false;
     }
     return true;
 }