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 2018/09/19 22:09:56 UTC

[trafficcontrol] branch master updated (c4965c1 -> c7e95f6)

This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.


    from c4965c1  Change TO DS SSL update to use riaksvc const
     new 506c9ad  Fix TO Go to mask field
     new c7e95f6  Change TO level for field mask

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 traffic_ops/traffic_ops_golang/server/detail.go | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)


[trafficcontrol] 02/02: Change TO level for field mask

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit c7e95f6f20e91699ae547f4ce95e930f10aacc5f
Author: Robert Butts <ro...@apache.org>
AuthorDate: Wed Sep 19 16:07:30 2018 -0600

    Change TO level for field mask
---
 traffic_ops/traffic_ops_golang/server/detail.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/traffic_ops/traffic_ops_golang/server/detail.go b/traffic_ops/traffic_ops_golang/server/detail.go
index 5488c21..c8c9a52 100644
--- a/traffic_ops/traffic_ops_golang/server/detail.go
+++ b/traffic_ops/traffic_ops_golang/server/detail.go
@@ -223,7 +223,7 @@ JOIN type t ON s.type = t.id
 		}
 
 		hiddenField := "********"
-		if user.PrivLevel < auth.PrivLevelAdmin {
+		if user.PrivLevel < auth.PrivLevelOperations {
 			s.ILOPassword = &hiddenField
 			s.XMPPPasswd = &hiddenField
 		}


[trafficcontrol] 01/02: Fix TO Go to mask field

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 506c9adba4f7f715e0c59a49036a6e1f312e27f6
Author: Robert Butts <ro...@apache.org>
AuthorDate: Wed Sep 19 15:59:12 2018 -0600

    Fix TO Go to mask field
---
 traffic_ops/traffic_ops_golang/server/detail.go | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/server/detail.go b/traffic_ops/traffic_ops_golang/server/detail.go
index 24f43ca..5488c21 100644
--- a/traffic_ops/traffic_ops_golang/server/detail.go
+++ b/traffic_ops/traffic_ops_golang/server/detail.go
@@ -28,6 +28,7 @@ import (
 	"github.com/apache/trafficcontrol/lib/go-tc"
 	"github.com/apache/trafficcontrol/lib/go-util"
 	"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api"
+	"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/auth"
 
 	"github.com/lib/pq"
 )
@@ -40,7 +41,7 @@ func GetDetailHandler(w http.ResponseWriter, r *http.Request) {
 	}
 	defer inf.Close()
 
-	servers, err := getDetailServers(inf.Tx.Tx, inf.Params["hostName"], -1, "", 0)
+	servers, err := getDetailServers(inf.Tx.Tx, inf.User, inf.Params["hostName"], -1, "", 0)
 	if err != nil {
 		api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New("getting detail servers: "+err.Error()))
 		return
@@ -89,7 +90,7 @@ func GetDetailParamHandler(w http.ResponseWriter, r *http.Request) {
 			return
 		}
 	}
-	servers, err := getDetailServers(inf.Tx.Tx, hostName, physLocationID, util.CamelToSnakeCase(orderBy), limit)
+	servers, err := getDetailServers(inf.Tx.Tx, inf.User, hostName, physLocationID, util.CamelToSnakeCase(orderBy), limit)
 	respVals := map[string]interface{}{
 		"orderby": orderBy,
 		"limit":   limit,
@@ -98,7 +99,7 @@ func GetDetailParamHandler(w http.ResponseWriter, r *http.Request) {
 	api.RespWriterVals(w, r, inf.Tx.Tx, respVals)(servers, err)
 }
 
-func getDetailServers(tx *sql.Tx, hostName string, physLocationID int, orderBy string, limit int) ([]tc.ServerDetail, error) {
+func getDetailServers(tx *sql.Tx, user *auth.CurrentUser, hostName string, physLocationID int, orderBy string, limit int) ([]tc.ServerDetail, error) {
 	allowedOrderByCols := map[string]string{
 		"":                 "",
 		"cachegroup":       "s.cachegroup",
@@ -220,6 +221,13 @@ JOIN type t ON s.type = t.id
 		if err := rows.Scan(&s.CacheGroup, &s.CDNName, pq.Array(&s.DeliveryServiceIDs), &s.DomainName, &s.GUID, &s.HostName, &s.HTTPSPort, &s.ID, &s.ILOIPAddress, &s.ILOIPGateway, &s.ILOIPNetmask, &s.ILOPassword, &s.ILOUsername, &s.InterfaceMTU, &s.InterfaceName, &s.IP6Address, &s.IP6Gateway, &s.IPAddress, &s.IPGateway, &s.IPNetmask, &s.MgmtIPAddress, &s.MgmtIPGateway, &s.MgmtIPNetmask, &s.OfflineReason, &s.PhysLocation, &s.Profile, &s.ProfileDesc, &s.Rack, &s.RouterHostName, &s.RouterPortName [...]
 			return nil, errors.New("Error scanning detail server: " + err.Error())
 		}
+
+		hiddenField := "********"
+		if user.PrivLevel < auth.PrivLevelAdmin {
+			s.ILOPassword = &hiddenField
+			s.XMPPPasswd = &hiddenField
+		}
+
 		servers = append(servers, s)
 		sIDs = append(sIDs, *s.ID)
 	}