aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-02-28 15:32:22 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-02-28 17:21:36 +0000
commitd830c40740b24537477627e0923c13f3b9ff6099 (patch)
tree5c251cea24ba3ad0022d6cf71c7324c15045f49f
parent9a6db4f6e5b9c83c8f3c1ea70c46beb8424430c3 (diff)
Only output appcache/manifest for shortlist users.
The interception of 404s etc is too much of an inconvenience.
-rw-r--r--perllib/FixMyStreet/App/Controller/Offline.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Offline.pm b/perllib/FixMyStreet/App/Controller/Offline.pm
index 5f3b69f2e..dceccc81f 100644
--- a/perllib/FixMyStreet/App/Controller/Offline.pm
+++ b/perllib/FixMyStreet/App/Controller/Offline.pm
@@ -17,9 +17,15 @@ On staging site, appcache only for people who want it.
=cut
+sub have_appcache : Private {
+ my ($self, $c) = @_;
+ return $c->user_exists && $c->user->has_body_permission_to('planned_reports')
+ && !FixMyStreet->staging_flag('enable_appcache', 0);
+}
+
sub manifest : Path("/offline/appcache.manifest") {
my ($self, $c) = @_;
- if (FixMyStreet->staging_flag('enable_appcache', 0)) {
+ unless ($c->forward('have_appcache')) {
$c->response->status(404);
$c->response->body('NOT FOUND');
}
@@ -30,7 +36,7 @@ sub manifest : Path("/offline/appcache.manifest") {
sub appcache : Path("/offline/appcache") {
my ($self, $c) = @_;
$c->detach('/page_error_404_not_found', []) if keys %{$c->req->params};
- if (FixMyStreet->staging_flag('enable_appcache', 0)) {
+ unless ($c->forward('have_appcache')) {
$c->response->status(404);
$c->response->body('NOT FOUND');
}