diff options
author | Struan Donald <struan@exo.org.uk> | 2011-07-27 13:54:46 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-07-27 13:54:46 +0100 |
commit | e1801441beb37f37857c925a3c8c889653da4fe9 (patch) | |
tree | d12e6335e11da59396f109bc93abf128bf13089c /perllib/FixMyStreet/DB/Result/User.pm | |
parent | 54066cd1387643dd6c6cb3040c520bee66881fd7 (diff) |
allow council user to update state on problem sent to multiple councils
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 19 |
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; |