aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/User.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index ada19a406..ceced7267 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -151,4 +151,23 @@ sub council {
return $result;
}
+=head2 belongs_to_council
+
+ $belongs_to_council = $user->belongs_to_council( $council_list );
+
+Returns true if the user belongs to the comma seperated list of council ids passed in
+
+=cut
+
+sub belongs_to_council {
+ my $self = shift;
+ my $council = shift;
+
+ my %councils = map { $_ => 1 } split ',', $council;
+
+ return 1 if $self->from_council && $councils{ $self->from_council };
+
+ return 0;
+}
+
1;