Title: [opsview] [12716] Moved info_for_monitors_list out of /admin/servicecheck, because the ACL
Revision
12716
Author
tvoon
Date
2013-06-28 13:22:18 +0100 (Fri, 28 Jun 2013)

Log Message

Moved info_for_monitors_list out of /admin/servicecheck, because the ACL
for this requires two different permissions which doesn't fit
with the new way of ACLs, so now in Public with appropriate ACLs there now

Modified Paths

Added Paths

Removed Paths

Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Admin/Servicecheck.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Admin/Servicecheck.pm	2013-06-28 11:33:31 UTC (rev 12715)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Admin/Servicecheck.pm	2013-06-28 12:22:18 UTC (rev 12716)
@@ -214,19 +214,5 @@
     $c->stash( wrapper  => "wrappers/menu" );
 }
 
-sub info_for_monitors_list : Local : Args(1) : Does(ACL) :
-  AllowedRole(CONFIGUREVIEW) : AllowedRole(CONFIGUREHOSTS) :
-  ACLDetachTo(/access_denied) :
-{
-    my ( $self, $c ) = @_;
-    $c->stash( via => scalar $c->req->param("via") );
-    $c->stash(
-        checked => ( ( scalar $c->req->param("checked") ) eq "true" ? 1 : 0 )
-    );
-    $c->stash( state => $c->req->params->{state} );
-    $c->stash( central_servicecheck_configuration => 1 );
-    $c->stash( wrapper                            => "wrappers/blank" );
-}
-
 __PACKAGE__->meta->make_immutable;
 1;

Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Public.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Public.pm	2013-06-28 11:33:31 UTC (rev 12715)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Public.pm	2013-06-28 12:22:18 UTC (rev 12716)
@@ -182,4 +182,27 @@
     }
 }
 
+sub info_for_monitors_list : Local : Args(1) : Does(ACL) :
+  AllowedRole(CONFIGUREVIEW) : AllowedRole(CONFIGUREHOSTS) :
+  ACLDetachTo(/access_denied) :
+{
+    my ( $self, $c, $sid ) = @_;
+
+    $c->stash( wrapper => "wrappers/blank" );
+
+    my $servicecheck = $c->model("OpsviewSchema::Servicechecks")->find($sid);
+    unless ($servicecheck) {
+        $c->res->body( "Servicecheck not found for $sid" );
+        $c->detach;
+    }
+
+    $c->stash( object => $servicecheck );
+    $c->stash( via    => scalar $c->req->param("via") );
+    $c->stash(
+        checked => ( ( scalar $c->req->param("checked") ) eq "true" ? 1 : 0 )
+    );
+    $c->stash( state => $c->req->params->{state} );
+    $c->stash( central_servicecheck_configuration => 1 );
+}
+
 1;

Modified: trunk/opsview-web/lib/Opsview/Web.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web.pm	2013-06-28 11:33:31 UTC (rev 12715)
+++ trunk/opsview-web/lib/Opsview/Web.pm	2013-06-28 12:22:18 UTC (rev 12716)
@@ -418,69 +418,6 @@
 # an appropriate hook
 __PACKAGE__->setup;
 
-# All the authentication below has moved to ActionRoles, specified at the
-# URL definition, rather than here
-# Below can be removed when proven to work properly
-
-# This allows these two roles through underneath, but you will need to split off
-# anything with more specific access with denies further down the path
-#__PACKAGE__->deny_access_unless( "/admin", [qw/CONFIGUREVIEW/], );
-
-# Required to check /user/preference too
-#__PACKAGE__->allow_access("/admin/check_save_access");
-
-# Allow this for /user/preference - has its own access denied routines
-#__PACKAGE__->allow_access("/admin/ajax/send_test_sms");
-
-# View access required for /event
-# Seems a silly way of specifying it, but this means you have to have VIEWSOME or VIEWALL to see
-# t/720acl.t checks the correct accesses
-#__PACKAGE__->allow_access_if( "/event",     [qw/VIEWSOME/] );
-#__PACKAGE__->deny_access_unless( "/event",  [qw/VIEWALL/] );
-#__PACKAGE__->allow_access_if( "/search",    [qw/VIEWSOME/] );
-#__PACKAGE__->deny_access_unless( "/search", [qw/VIEWALL/] );
-
-# Required to get the authentication if directly going to this page
-#__PACKAGE__->allow_access("/event/auto");
-
-#__PACKAGE__->allow_access_if( "/search",    [qw/VIEWSOME/] );
-#__PACKAGE__->deny_access_unless( "/search", [qw/VIEWALL/] );
-#__PACKAGE__->allow_access("/search/auto");
-
-# Auto is required for all access to get to admin pages
-#__PACKAGE__->allow_access("/admin/auto");
-#__PACKAGE__->allow_access("/admin/meta_redirect");
-
-# Need these two rules on /admin/host so that only CONFIGUREHOSTS is allowed
-#__PACKAGE__->deny_access_unless( "/admin/host",                     [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/host",                        [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/strip_blank_servicechecks",   [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/convert_servicechecks_input", [qw/CONFIGUREHOSTS/], );
-
-#__PACKAGE__->allow_access_if( "/admin/snmpwalk", [qw/CONFIGUREHOSTS/], );
-
-#__PACKAGE__->allow_access_if( "/admin/ajax", [qw/CONFIGUREHOSTS/], );
-
-# The two rules below are to allow CONFIGUREHOSTS to also get to these parts
-# ADMINACCESS will inherit the /admin/servicecheck allow above
-#__PACKAGE__->allow_access_if( "/admin/servicecheck/info_for_monitors_list", [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/serviceoption",                       [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/servicecheck/auto",                   [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/ajax/options_for_parent_hosts",       [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/servicegroup/auto",                   [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/snmpwalk/auto",                       [qw/CONFIGUREHOSTS/], );
-#__PACKAGE__->allow_access_if( "/admin/servicegroup/services",               [qw/CONFIGUREHOSTS/], );
-
-# Reload ability
-#__PACKAGE__->allow_access_if( "/admin/reload",    [qw/RELOADACCESS/], );
-#__PACKAGE__->deny_access_unless( "/admin/reload", [qw/RELOADACCESS/], );
-#__PACKAGE__->allow_access_if( "/admin/status",    [qw/RELOADACCESS/], );
-#__PACKAGE__->deny_access_unless( "/admin/status", [qw/RELOADACCESS/], );
-
-# Block Audit log unless ADMINACCESS only
-#__PACKAGE__->allow_access_if( "/admin/auditlog",    [qw/ADMINACCESS/], );
-#__PACKAGE__->deny_access_unless( "/admin/auditlog", [qw/ADMINACCESS/], );
-
 # This config can be applied after setup without issue as it doesn't provide
 # any necessary info to any modules.  Cannot be run before setup since the
 # info required isn't loaded from the yml file

Deleted: trunk/opsview-web/root/admin/servicecheck/info_for_monitors_list
===================================================================
--- trunk/opsview-web/root/admin/servicecheck/info_for_monitors_list	2013-06-28 11:33:31 UTC (rev 12715)
+++ trunk/opsview-web/root/admin/servicecheck/info_for_monitors_list	2013-06-28 12:22:18 UTC (rev 12716)
@@ -1,4 +0,0 @@
-[% 
-PROCESS "servicecheck_buttons";
-print_servicecheck_buttons(object, state);
-%]

Modified: trunk/opsview-web/root/admin/servicecheck_buttons
===================================================================
--- trunk/opsview-web/root/admin/servicecheck_buttons	2013-06-28 11:33:31 UTC (rev 12715)
+++ trunk/opsview-web/root/admin/servicecheck_buttons	2013-06-28 12:22:18 UTC (rev 12716)
@@ -17,7 +17,7 @@
 	timeperiod.$id = t.name;
 END;
 
-buttons_uri = c.uri_for("/admin/servicecheck/info_for_monitors_list/").path_query;
+buttons_uri = c.uri_for("/public/info_for_monitors_list/").path_query;
 servicecheck_uri = c.uri_for("/admin/servicecheck/edit/").path_query;
 
 MACRO print_servicegroup_heading( text ) BLOCK;
@@ -90,7 +90,7 @@
 namespace = via || namespace;
 
 MACRO print_servicecheck_buttons(sc, state) BLOCK;
-  # Need the || below because via /admin/servicecheck/info_for_monitors_list, sc.checktype returns an object, whereas /admin/host/edit
+  # Need the || below because via /public/info_for_monitors_list, sc.checktype returns an object, whereas /admin/host/edit
   # returns a hash attribute
   IF state == "add" && (sc.checktype == 1 || sc.checktype.id == 1);
     print_active_servicecheck_buttons(sc);

Added: trunk/opsview-web/root/public/info_for_monitors_list
===================================================================
--- trunk/opsview-web/root/public/info_for_monitors_list	                        (rev 0)
+++ trunk/opsview-web/root/public/info_for_monitors_list	2013-06-28 12:22:18 UTC (rev 12716)
@@ -0,0 +1,4 @@
+[% 
+PROCESS "servicecheck_buttons";
+print_servicecheck_buttons(object, state);
+%]

Modified: trunk/opsview-web/t/751monitors.t
===================================================================
--- trunk/opsview-web/t/751monitors.t	2013-06-28 11:33:31 UTC (rev 12715)
+++ trunk/opsview-web/t/751monitors.t	2013-06-28 12:22:18 UTC (rev 12716)
@@ -22,7 +22,7 @@
 log_in( $mech, 'admin', 'initial', "http://localhost:3000" );
 
 $mech->get_ok(
-    "/admin/servicecheck/info_for_monitors_list/96?checked=true&state=add&via=host"
+    "/public/info_for_monitors_list/96?checked=true&state=add&via=host"
 );
 $mech->content_contains( 'id="div_event_handler_96_add"' );
 $mech->content_contains(

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to