aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-09-10 14:49:30 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-09-13 08:33:24 +0100
commitf2a5d899308634fb06605a1d8035e19eadb8932a (patch)
treefe7ecbb80f9699ca8a26eef8dca63acaabf7938f /perllib/FixMyStreet/DB
parent42bbac994c625e24a6eb645de9c47a7dd2b226ef (diff)
Add cobrand hook for disallowing title moderation.
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 246159009..c50f8834c 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -350,6 +350,17 @@ sub can_moderate {
return $cobrand->call_hook('moderate_permission', $self, $type => $object);
}
+sub can_moderate_title {
+ my ($self, $problem, $perm) = @_;
+
+ # Must have main permission, this is to potentially restrict only
+ return 0 unless $perm;
+
+ # If hook returns anything use it, otherwise default to yes
+ my $cobrand = $self->result_source->schema->cobrand;
+ return $cobrand->call_hook('moderate_permission_title', $self, $problem) // 1;
+}
+
has body_permissions => (
is => 'ro',
lazy => 1,