aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/admin
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-04-15 19:12:31 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-05-08 08:35:42 +0100
commitecc5a7b9ca20418f1bdb45cdc3ce5b41a11f3593 (patch)
tree32e1397d2f156d735a822775f9880610e7cce34f /t/app/controller/admin
parent7d395d5ca8049a904473e90957115ce675e57db7 (diff)
Add assigned_(users|categories)_only functionality
Users with assigned_categories_only will only see staff features on a report page in their assigned categories. Users will only see staff features on a report page in a category with assigned_users_only if it is in their assigned categories.
Diffstat (limited to 't/app/controller/admin')
-rw-r--r--t/app/controller/admin/bodies.t10
-rw-r--r--t/app/controller/admin/users.t10
2 files changed, 19 insertions, 1 deletions
diff --git a/t/app/controller/admin/bodies.t b/t/app/controller/admin/bodies.t
index d3e4074f9..883386380 100644
--- a/t/app/controller/admin/bodies.t
+++ b/t/app/controller/admin/bodies.t
@@ -261,6 +261,16 @@ subtest 'open311 protection editing' => sub {
is $contact->get_extra_metadata('open311_protect'), 1, 'Open311 protect flag set';
};
+subtest 'test assigned_users_only setting' => sub {
+ $mech->get_ok('/admin/body/' . $body->id . '/test%20category');
+ $mech->submit_form_ok( { with_fields => {
+ assigned_users_only => 1,
+ } } );
+ $mech->content_contains('Values updated');
+ my $contact = $body->contacts->find({ category => 'test category' });
+ is $contact->get_extra_metadata('assigned_users_only'), 1;
+};
+
subtest 'updates disabling' => sub {
$mech->get_ok('/admin/body/' . $body->id . '/test%20category');
$mech->submit_form_ok( { with_fields => {
diff --git a/t/app/controller/admin/users.t b/t/app/controller/admin/users.t
index 4f0298103..bc8d28e2d 100644
--- a/t/app/controller/admin/users.t
+++ b/t/app/controller/admin/users.t
@@ -299,6 +299,7 @@ FixMyStreet::override_config {
flagged => undef,
is_superuser => undef,
area_ids => undef,
+ assigned_categories_only => undef,
%default_perms,
roles => $role->id,
},
@@ -320,6 +321,7 @@ FixMyStreet::override_config {
flagged => undef,
is_superuser => undef,
area_ids => undef,
+ assigned_categories_only => undef,
%default_perms,
roles => $role->id,
},
@@ -341,6 +343,7 @@ FixMyStreet::override_config {
flagged => undef,
is_superuser => undef,
area_ids => undef,
+ assigned_categories_only => undef,
%default_perms,
roles => $role->id,
},
@@ -365,6 +368,7 @@ FixMyStreet::override_config {
flagged => undef,
is_superuser => undef,
area_ids => undef,
+ assigned_categories_only => undef,
%default_perms,
},
changes => {
@@ -385,6 +389,7 @@ FixMyStreet::override_config {
flagged => 'on',
is_superuser => undef,
area_ids => undef,
+ assigned_categories_only => undef,
%default_perms,
},
changes => {
@@ -394,7 +399,7 @@ FixMyStreet::override_config {
log_entries => [qw/edit edit edit edit/],
},
{
- desc => 'edit user add is_superuser',
+ desc => 'edit user add is_superuser and assigned_categories_only',
fields => {
name => 'Changed User',
email => 'changed@example.com',
@@ -405,10 +410,12 @@ FixMyStreet::override_config {
flagged => undef,
is_superuser => undef,
area_ids => undef,
+ assigned_categories_only => undef,
%default_perms,
},
changes => {
is_superuser => 'on',
+ assigned_categories_only => 'on',
},
removed => [
keys %default_perms,
@@ -428,6 +435,7 @@ FixMyStreet::override_config {
flagged => undef,
is_superuser => 'on',
area_ids => undef,
+ assigned_categories_only => 'on',
},
changes => {
is_superuser => undef,