aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-09-27 17:28:45 +0100
committerStruan Donald <struan@exo.org.uk>2018-09-28 14:21:07 +0100
commit31e2a02395b4b3479e8abb7949a29fc437aa6ef6 (patch)
tree53673dbf030c5ab27c781f2c1591336662158d60
parent0b9557c371a64fa9c1fc699ce3a8959c6131cb92 (diff)
[Oxfordshire] remove access to inspector tool
-rw-r--r--perllib/FixMyStreet/Cobrand/Oxfordshire.pm7
-rw-r--r--t/app/controller/admin/defecttypes.t11
-rw-r--r--t/app/controller/admin/permissions.t8
-rw-r--r--t/app/controller/my_planned.t8
4 files changed, 34 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
index be404c4be..392bf37c3 100644
--- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
@@ -234,6 +234,13 @@ sub available_permissions {
my $perms = $self->next::method();
$perms->{Bodies}->{defect_type_edit} = "Add/edit defect types";
+ delete $perms->{Problems}->{report_edit};
+ delete $perms->{Problems}->{report_edit_category};
+ delete $perms->{Problems}->{report_edit_priority};
+ delete $perms->{Problems}->{report_inspect};
+ delete $perms->{Problems}->{report_instruct};
+ delete $perms->{Problems}->{planned_reports};
+
return $perms;
}
diff --git a/t/app/controller/admin/defecttypes.t b/t/app/controller/admin/defecttypes.t
index 1eaab8414..12ae8948c 100644
--- a/t/app/controller/admin/defecttypes.t
+++ b/t/app/controller/admin/defecttypes.t
@@ -1,4 +1,5 @@
use FixMyStreet::TestMech;
+use Test::MockModule;
my $mech = FixMyStreet::TestMech->new;
@@ -26,6 +27,16 @@ FixMyStreet::override_config { ALLOWED_COBRANDS => ['bromley'], }, sub {
FixMyStreet::override_config { ALLOWED_COBRANDS => ['oxfordshire'], }, sub {
+ my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
+ $cobrand->mock('available_permissions', sub {
+ my $self = shift;
+
+ my $perms = FixMyStreet::Cobrand::Default->available_permissions;
+ $perms->{Bodies}->{defect_type_edit} = "Add/edit defect types";
+
+ return $perms;
+ });
+
my $body = $mech->create_body_ok( 2237, 'Oxfordshire County Council' );
subtest 'check defect types menu available to superusers' => sub {
diff --git a/t/app/controller/admin/permissions.t b/t/app/controller/admin/permissions.t
index e7f85d140..3fc221a63 100644
--- a/t/app/controller/admin/permissions.t
+++ b/t/app/controller/admin/permissions.t
@@ -1,4 +1,5 @@
use FixMyStreet::TestMech;
+use Test::MockModule;
my $mech = FixMyStreet::TestMech->new;
@@ -28,6 +29,13 @@ ok $report, "created test report - $report_id";
$mech->log_in_ok( $oxfordshireuser->email );
+my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
+$cobrand->mock('available_permissions', sub {
+ my $self = shift;
+
+ return FixMyStreet::Cobrand::Default->available_permissions;
+});
+
subtest "Users can't edit report without report_edit permission" => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'oxfordshire' ],
diff --git a/t/app/controller/my_planned.t b/t/app/controller/my_planned.t
index 67d59e148..a6a47a798 100644
--- a/t/app/controller/my_planned.t
+++ b/t/app/controller/my_planned.t
@@ -1,4 +1,5 @@
use FixMyStreet::TestMech;
+use Test::MockModule;
my $mech = FixMyStreet::TestMech->new;
$mech->get_ok('/my/planned');
@@ -187,6 +188,13 @@ FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'oxfordshire' ],
BASE_URL => 'http://oxfordshire.fixmystreet.site',
}, sub {
+ my $cobrand = Test::MockModule->new('FixMyStreet::Cobrand::Oxfordshire');
+ $cobrand->mock('available_permissions', sub {
+ my $self = shift;
+
+ return FixMyStreet::Cobrand::Default->available_permissions;
+ });
+
subtest "can remove problems not displayed in cobrand from shortlist" => sub {
$user->user_planned_reports->remove();
my ($problem1) = $mech->create_problems_for_body(2, $body->id, 'New Problem');