From 205bffc2d1b558311a1d2bf61a3cefe60fe326d2 Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Fri, 3 Mar 2017 18:32:05 +0100 Subject: [PATCH] TT#10402 prevent unban with readonly user Change-Id: I9d8e14a552a9eb2a8df47c155753e7892ff7f331 --- lib/NGCP/Panel/Controller/Security.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/NGCP/Panel/Controller/Security.pm b/lib/NGCP/Panel/Controller/Security.pm index 30bde0a8c1..c1982fcd17 100644 --- a/lib/NGCP/Panel/Controller/Security.pm +++ b/lib/NGCP/Panel/Controller/Security.pm @@ -40,6 +40,11 @@ sub ip_base :Chained('/') :PathPart('security/ip') :CaptureArgs(1) { sub ip_unban :Chained('ip_base') :PathPart('unban') :Args(0) { my ( $self, $c ) = @_; + + if ($c->user->read_only) { + $c->detach('/denied_page'); + } + my $ip = $c->stash->{ip}; NGCP::Panel::Utils::Security::ip_unban($c, $ip); NGCP::Panel::Utils::Message::info( @@ -58,6 +63,11 @@ sub user_base :Chained('/') :PathPart('security/user') :CaptureArgs(1) { sub user_unban :Chained('user_base') :PathPart('unban') :Args(0) { my ( $self, $c ) = @_; + + if ($c->user->read_only) { + $c->detach('/denied_page'); + } + my $user = $c->stash->{user}; NGCP::Panel::Utils::Security::user_unban($c, $user); NGCP::Panel::Utils::Message::info(