You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/01/10 03:38:45 UTC

[33/50] incubator-trafficcontrol git commit: ensures only ops or admin role can snapshot crconfig

ensures only ops or admin role can snapshot crconfig


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c6d312a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c6d312a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c6d312a8

Branch: refs/heads/master
Commit: c6d312a8dc80151df1f57a8aafe4d72e06aa66e9
Parents: a4dee0d
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Dec 9 12:37:08 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700

----------------------------------------------------------------------
 traffic_ops/app/lib/UI/Tools.pm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c6d312a8/traffic_ops/app/lib/UI/Tools.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Tools.pm b/traffic_ops/app/lib/UI/Tools.pm
index 218f197..8b385fb 100644
--- a/traffic_ops/app/lib/UI/Tools.pm
+++ b/traffic_ops/app/lib/UI/Tools.pm
@@ -113,9 +113,13 @@ sub write_crconfig {
         $self->flash( alertmsg => $error );
     }
     else {
-        UI::Topology::write_crconfig_json_to_db( $self, $cdn_name, $json );
-        &log( $self, "Snapshot CRConfig created.", "OPER" );
-        $self->flash( alertmsg => "Successfully wrote CRConfig.json!" );
+        if ( !&is_oper($self) ) {
+            $self->flash( alertmsg => "No can do. Get more privs." );
+        } else {
+            UI::Topology::write_crconfig_json_to_db( $self, $cdn_name, $json );
+            &log( $self, "Snapshot CRConfig created.", "OPER" );
+            $self->flash( alertmsg => "Successfully wrote CRConfig.json!" );
+        }
     }
     return $self->redirect_to('/utils/close_fancybox');
 }