aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/SeeSomething.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-07-06 18:07:22 +0100
committerDave Arter <davea@mysociety.org>2016-07-19 17:56:22 +0100
commit6afbfe45183412e35e8e846fd0d4a9d846c8644b (patch)
tree3f5cb6173c08a571811f0a31508b45acf31d69f7 /perllib/FixMyStreet/Cobrand/SeeSomething.pm
parent65545553b5171f1ef1d611ea93c38f138451fb31 (diff)
Use normal user authentication to control access to /admin
- Adds is_superuser flag to User - Logged-in user must be a superuser or have from_body set in order to access anything within /admin - has_permission_to on a superuser will always return true - Only superusers can create/grant superusers - New `createsuperuser` command for creating superusers
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/SeeSomething.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/SeeSomething.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/SeeSomething.pm b/perllib/FixMyStreet/Cobrand/SeeSomething.pm
index 22750aafa..4d4dd000e 100644
--- a/perllib/FixMyStreet/Cobrand/SeeSomething.pm
+++ b/perllib/FixMyStreet/Cobrand/SeeSomething.pm
@@ -60,6 +60,11 @@ sub allow_anonymous_reports { 1; }
sub anonymous_account { return { name => 'Anonymous Submission', email => FixMyStreet->config('DO_NOT_REPLY_EMAIL') }; }
+sub admin_allow_user {
+ my ( $self, $user ) = @_;
+ return 1 if ( $user->from_body || $user->is_superuser );
+}
+
sub admin_pages {
my $self = shift;