From 5f579853c13959d314b2155703fd03642be03443 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 13 Dec 2016 16:41:44 +0000 Subject: Fail in has_permission_to if given an empty arrayref. --- perllib/FixMyStreet/DB/Result/User.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 028394795..f4e5144f8 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -268,7 +268,7 @@ sub has_permission_to { my ($self, $permission_type, $body_ids) = @_; return 1 if $self->is_superuser; - return 0 unless $body_ids; + return 0 if !$body_ids || (ref $body_ids && !@$body_ids); my $permission = $self->user_body_permissions->find({ permission_type => $permission_type, -- cgit v1.2.3