diff options
author | Dave Arter <davea@mysociety.org> | 2016-09-13 17:17:23 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-09-20 16:07:32 +0100 |
commit | 9bc2476861811163663b45cac41a2e91273576ed (patch) | |
tree | 26ada3a90213334dfbc1f5e6ef6e6d1e9a800878 /perllib/FixMyStreet/DB/Result/User.pm | |
parent | b01df0c7609a1d6c008b943a9936d471cf0e0ce3 (diff) |
Add ‘trusted’ flag allowing users to make reports directly
When a trusted user makes a report in a category that requires inspection, it'll
be sent immediately (i.e. without being inspected first).
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 56196c7c0..48b688000 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -292,6 +292,22 @@ sub has_body_permission_to { return $self->has_permission_to($permission_type, $self->from_body->id); } +=head2 admin_user_body_permissions + +Some permissions aren't managed in the normal way via the admin, e.g. the +'trusted' permission. This method returns a query that excludes such exceptional +permissions. + +=cut + +sub admin_user_body_permissions { + my $self = shift; + + return $self->user_body_permissions->search({ + permission_type => { '!=' => 'trusted' }, + }); +} + sub contributing_as { my ($self, $other, $c, $bodies) = @_; $bodies = [ keys %$bodies ] if ref $bodies eq 'HASH'; |