Skip to content

Commit

Permalink
Prevent non-admins from reopening purged requests
Browse files Browse the repository at this point in the history
Using email as the test here, which is what the rest of the application
uses. This is locked behind a new user right; distinct from reopening
old non-purged requests.

I've specifically set this as a tool admin task, not a "request admin
tools" task, as checkusers should have no need to reopen a purged
request. Opening old requests I could see being useful for a CU, but
there's nothing that can realistically be done for a purged request.
  • Loading branch information
stwalkerster committed Oct 14, 2020
1 parent 632b3f6 commit 7b36a51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions includes/Pages/RequestAction/PageDeferRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ protected function main()
}
}

if ($request->getEmail() === $this->getSiteConfiguration()->getDataClearEmail()) {
if (!$this->barrierTest('reopenClearedRequest', $currentUser, 'RequestData')) {
throw new ApplicationLogicException(
"You are not allowed to re-open a request for which the private data has been purged.");
}
}

if ($request->getStatus() === RequestStatus::JOBQUEUE) {
/** @var JobQueue[] $pendingJobs */
$pendingJobs = JobQueueSearchHelper::get($database)->byRequest($request->getId())->statusIn([
Expand Down
3 changes: 3 additions & 0 deletions includes/Security/RoleConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ class RoleConfiguration
'acknowledge' => self::ACCESS_ALLOW,
'requeue' => self::ACCESS_ALLOW,
),
'RequestData' => array(
'reopenClearedRequest' => self::ACCESS_ALLOW,
),
),
'checkuser' => array(
'_description' => 'A user with CheckUser access',
Expand Down

0 comments on commit 7b36a51

Please sign in to comment.