Title: [opsview] [13267] Merge of 12687,12691 from DEV-professional
Revision
13267
Author
tvoon
Date
2013-08-15 18:49:27 +0100 (Thu, 15 Aug 2013)

Log Message

Merge of 12687,12691 from DEV-professional

Modified Paths


Added Paths

Property Changed


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/DEV-capside/release-3.9.0:6365-6370
/branches/DEV-extra-notification-data:6734-6746
/branches/DEV-odw-calculations:9016-9160
/branches/DEV-restapi-monitoringservers:9778
/branches/DEV-snmp-multi:7324-7376
/branches/US187:9403-9479
/branches/US198b:8875-8994
/branches/US310:9851-9873
/branches/US539:12178-12182
/branches/enterprise/BRAN-3.14:6874,6882,6956
/branches/enterprise/DEV-professional:6494-8475,8477-8478,8486,8490,8492,8494,8499-8500,8515,8518-8519,8524,8527-8529,8531-8532,8536,8538,8540-8544,8547-8552,8554,8557,8600-8601,8637,8749,8772,8897,8917,8944-8945,8947,8950-8952,8967,8969,8979,8982,8987,8998,9006,9008,9011,9013,9026,9033-9036,9038,9040,9042,9044,9048,9050-9053,9062,9064-9065,9069,9078,9081,9088,9096,9099-9101,9103,9105,9115,9118,9347,9353-9354,9411,9432,9445,9486,9538-9550,9569-9571,9620,9635,9637-9638,9645-9647,9693,9699,9721,9814,9825,9857,9879,9881,9939,10002,10029,10038-10041,10070,10086,10093,10345,10347,10388,10407,10481,10549,10560-10562,10565,10568,10571,10577,10932,11025,11035,11360-11612,11798-11799,11920,12075-12076,12096,12189,12207,12232,12266,12288,12322,12334,12355,12372,12401-12406,12428,12491,12523,12539-12540,12544,12546,12555,12580,12583,12599-12600,12609,12611,12614-12615,12618,12624,12630-12631,12633,12643,12645-12646,12649,12653-12654,12657-12658,12660,12662-12663,12666,12668,12678-12679,
 12681-12682,12685,12744,12765,13126-13127,13211
/branches/nagvis-iframe:9764-9786
/branches/opsview2runtime:10960-11258
/branches/opsview2runtime_xs:11279-11303
/branches/us168:8759,8762-8763,8766-8768,8770,8774-8777,8794,8798-8799,8801-8803,8821-8822,8834,8837-8838,8932,8937,8947,8969,8977,8981,9004,9007,9009-9010,9012,9024,9049
/commercial/branches/BRAN-4.2:10944,11017
/commercial/branches/BRAN-4.3:12423-12426
/commercial/branches/US306-slaves:9804-9823
/commercial/branches/US307-network-map:9685-9837
   + /branches/DEV-capside/release-3.9.0:6365-6370
/branches/DEV-extra-notification-data:6734-6746
/branches/DEV-odw-calculations:9016-9160
/branches/DEV-restapi-monitoringservers:9778
/branches/DEV-snmp-multi:7324-7376
/branches/US187:9403-9479
/branches/US198b:8875-8994
/branches/US310:9851-9873
/branches/US539:12178-12182
/branches/enterprise/BRAN-3.14:6874,6882,6956
/branches/enterprise/DEV-professional:6494-8475,8477-8478,8486,8490,8492,8494,8499-8500,8515,8518-8519,8524,8527-8529,8531-8532,8536,8538,8540-8544,8547-8552,8554,8557,8600-8601,8637,8749,8772,8897,8917,8944-8945,8947,8950-8952,8967,8969,8979,8982,8987,8998,9006,9008,9011,9013,9026,9033-9036,9038,9040,9042,9044,9048,9050-9053,9062,9064-9065,9069,9078,9081,9088,9096,9099-9101,9103,9105,9115,9118,9347,9353-9354,9411,9432,9445,9486,9538-9550,9569-9571,9620,9635,9637-9638,9645-9647,9693,9699,9721,9814,9825,9857,9879,9881,9939,10002,10029,10038-10041,10070,10086,10093,10345,10347,10388,10407,10481,10549,10560-10562,10565,10568,10571,10577,10932,11025,11035,11360-11612,11798-11799,11920,12075-12076,12096,12189,12207,12232,12266,12288,12322,12334,12355,12372,12401-12406,12428,12491,12523,12539-12540,12544,12546,12555,12580,12583,12599-12600,12609,12611,12614-12615,12618,12624,12630-12631,12633,12643,12645-12646,12649,12653-12654,12657-12658,12660,12662-12663,12666,12668,12678-12679,
 12681-12682,12685,12687,12691,12744,12765,13126-13127,13211
/branches/nagvis-iframe:9764-9786
/branches/opsview2runtime:10960-11258
/branches/opsview2runtime_xs:11279-11303
/branches/us168:8759,8762-8763,8766-8768,8770,8774-8777,8794,8798-8799,8801-8803,8821-8822,8834,8837-8838,8932,8937,8947,8969,8977,8981,9004,9007,9009-9010,9012,9024,9049
/commercial/branches/BRAN-4.2:10944,11017
/commercial/branches/BRAN-4.3:12423-12426
/commercial/branches/US306-slaves:9804-9823
/commercial/branches/US307-network-map:9685-9837

Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Admin/Role.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Admin/Role.pm	2013-08-15 17:43:47 UTC (rev 13266)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Admin/Role.pm	2013-08-15 17:49:27 UTC (rev 13267)
@@ -69,32 +69,47 @@
     $c->stash( rs => $rs );
 };
 
-before 'list' => sub {
+sub list : Local : Args(0) : Does(ACL) : RequiresRole(CONFIGUREROLES) :
+  ACLDetachTo(/access_denied) {
     my ( $self, $c ) = @_;
+
     $c->stash( title_description => $c->loc("ui.admin.role.list.title") );
 
     # Need to make this a scalar otherwise an array is created
     my $rs = $c->stash->{rs}->search_ordered_roles;
     $c->stash( list_rs => $rs );
-};
 
-before 'reorder' => sub {
+    $self->next::method($c);
+
+}
+
+sub reorder : Local : Args(0) : Does(ACL) : RequiresRole(CONFIGUREROLES) :
+  ACLDetachTo(/access_denied) {
     my ( $self, $c ) = @_;
 
     # Don't allow reordering of system roles
     $c->stash->{list_search_criteria} = { "me.id" => { ">=" => 10 } };
-};
 
-after 'create_new' => sub {
-    my ( undef, $c ) = @_;
+    $self->next::method($c);
+
+}
+
+sub create_new : Path('new') : Args(0) : Does(ACL) :
+  RequiresRole(CONFIGUREROLES) : ACLDetachTo(/access_denied) {
+    my ( $self, $c ) = @_;
+    $self->next::method($c);
+    $c->stash( tabs_first_only => 1 );
+    $c->stash( submit_name     => "next" );
+}
+
+sub edit : Local : Args(1) : Does(ACL) : RequiresRole(CONFIGUREROLES) :
+  ACLDetachTo(/access_denied) {
+    my ( $self, $c, @args ) = @_;
+
+    $self->next::method( $c, @args );
+
     $c->stash( allowed_accesses => _allowed_accesses($c) );
-    $c->stash( tabs_first_only  => 1 );
-    $c->stash( submit_name      => "next" );
-};
 
-after 'edit' => sub {
-    my ( undef, $c ) = @_;
-    $c->stash( allowed_accesses => _allowed_accesses($c) );
     if ( my $p = $c->req->param("tab") ) {
         if ( $p =~ /^[1-9]$/ ) {
             $p = lc( $c->stash->{tabs}[ $p - 1 ] );
@@ -102,12 +117,15 @@
         }
         $c->stash( "initial_tab" => "tab-$p" );
     }
-};
 
-after 'clone' => sub {
-    my ( undef, $c ) = @_;
+}
+
+sub clone : Local : Args(1) : Does(ACL) : RequiresRole(CONFIGUREROLES) :
+  ACLDetachTo(/access_denied) {
+    my ( $self, $c, @args ) = @_;
+    $self->next::method( $c, @args );
     $c->stash( allowed_accesses => _allowed_accesses($c) );
-};
+}
 
 sub meta_redirect : Private {
     my ( $self, $c, @args ) = @_;

Modified: trunk/opsview-web/lib/Opsview/Web/Controller/REST/Config/Role.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/REST/Config/Role.pm	2013-08-15 17:43:47 UTC (rev 13266)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/REST/Config/Role.pm	2013-08-15 17:49:27 UTC (rev 13267)
@@ -32,7 +32,7 @@
 );
 
 sub objecttype : Chained("/rest/config_root") : CaptureArgs(0) :
-  PathPart("role") : Does(ACL) : RequiresRole(CONFIGUREVIEW) :
+  PathPart("role") : Does(ACL) : RequiresRole(CONFIGUREROLES) :
   ACLDetachTo(/access_denied) {
 }
 

Added: trunk/opsview-web/t/var/api/role02_put.testcase
===================================================================
--- trunk/opsview-web/t/var/api/role02_put.testcase	                        (rev 0)
+++ trunk/opsview-web/t/var/api/role02_put.testcase	2013-08-15 17:49:27 UTC (rev 13267)
@@ -0,0 +1,170 @@
+PUT /rest/config/role/10
+{
+   "access_hostgroups" : [
+      {
+         "name" : "Leaf2"
+      }
+   ],
+   "access_keywords" : [
+      {
+         "name" : "cisco"
+      }
+   ],
+   "access_servicegroups" : [
+      {
+         "name" : "operations"
+      }
+   ],
+   "accesses" : [
+      {
+         "name" : "VIEWALL",
+         "ref" : "/rest/config/access/1"
+      },
+      {
+         "name" : "ACTIONALL",
+         "ref" : "/rest/config/access/3"
+      },
+      {
+         "name" : "CONFIGUREHOSTS",
+         "ref" : "/rest/config/access/7"
+      },
+      {
+         "name" : "RELOADACCESS",
+         "ref" : "/rest/config/access/8"
+      },
+      {
+         "name" : "ADMINACCESS",
+         "ref" : "/rest/config/access/9"
+      },
+      {
+         "name" : "CONFIGUREVIEW",
+         "ref" : "/rest/config/access/12"
+      },
+      {
+         "name" : "CONFIGURESAVE",
+         "ref" : "/rest/config/access/13"
+      },
+      {
+         "name" : "CONFIGUREPROFILES"
+      },
+      {
+         "name" : "CONFIGUREROLES"
+      },
+      {
+         "name" : "PASSWORDSAVE",
+         "ref" : "/rest/config/access/14"
+      }
+   ],
+   "all_hostgroups" : 0,
+   "all_keywords" : 1,
+   "all_servicegroups" : 0,
+   "contacts" : [
+      {
+         "name" : "admin",
+         "ref" : "/rest/config/contact/1"
+      },
+      {
+         "name" : "nonadmin"
+      }
+   ],
+   "description" : "Administrator access",
+   "hostgroups" : [
+      {
+         "name" : "Opsview",
+         "ref" : "/rest/config/hostgroup/1"
+      }
+   ],
+   "monitoringservers" : [],
+   "name" : "Admin"
+}
+ENDCONTENT
+{
+   "object" : {
+      "access_hostgroups" : [
+         {
+            "name" : "Leaf2",
+            "ref" : "/rest/config/hostgroup/5"
+         }
+      ],
+      "access_keywords" : [
+         {
+            "name" : "cisco",
+            "ref" : "/rest/config/keyword/2"
+         }
+      ],
+      "access_servicegroups" : [
+         {
+            "name" : "Operations",
+            "ref" : "/rest/config/servicegroup/1"
+         }
+      ],
+      "accesses" : [
+         {
+            "name" : "ACTIONALL",
+            "ref" : "/rest/config/access/3"
+         },
+         {
+            "name" : "ADMINACCESS",
+            "ref" : "/rest/config/access/9"
+         },
+         {
+            "name" : "CONFIGUREHOSTS",
+            "ref" : "/rest/config/access/7"
+         },
+         {
+            "name" : "CONFIGUREPROFILES",
+            "ref" : "/rest/config/access/23"
+         },
+         {
+            "name" : "CONFIGUREROLES",
+            "ref" : "/rest/config/access/27"
+         },
+         {
+            "name" : "CONFIGURESAVE",
+            "ref" : "/rest/config/access/13"
+         },
+         {
+            "name" : "CONFIGUREVIEW",
+            "ref" : "/rest/config/access/12"
+         },
+         {
+            "name" : "PASSWORDSAVE",
+            "ref" : "/rest/config/access/14"
+         },
+         {
+            "name" : "RELOADACCESS",
+            "ref" : "/rest/config/access/8"
+         },
+         {
+            "name" : "VIEWALL",
+            "ref" : "/rest/config/access/1"
+         }
+      ],
+      "all_hostgroups" : "0",
+      "all_keywords" : "1",
+      "all_monitoringservers" : "1",
+      "all_servicegroups" : "0",
+      "contacts" : [
+         {
+            "name" : "admin",
+            "ref" : "/rest/config/contact/1"
+         },
+         {
+            "name" : "nonadmin",
+            "ref" : "/rest/config/contact/2"
+         }
+      ],
+      "description" : "Administrator access",
+      "hostgroups" : [
+         {
+            "name" : "Opsview",
+            "ref" : "/rest/config/hostgroup/1"
+         }
+      ],
+      "id" : "10",
+      "monitoringservers" : [],
+      "name" : "Admin",
+      "tenancy" : null,
+      "uncommitted" : "1"
+   }
+}

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

Reply via email to