Browse Source

removed unneccasy api exposure

0xdcarns 3 years ago
parent
commit
03d35528cc
2 changed files with 1 additions and 21 deletions
  1. 1 1
      controllers/network.go
  2. 0 20
      controllers/node.go

+ 1 - 1
controllers/network.go

@@ -35,9 +35,9 @@ func networkHandlers(r *mux.Router) {
 	r.HandleFunc("/api/networks/{networkname}/keys", securityCheck(false, http.HandlerFunc(createAccessKey))).Methods("POST")
 	r.HandleFunc("/api/networks/{networkname}/keys", securityCheck(false, http.HandlerFunc(getAccessKeys))).Methods("GET")
 	r.HandleFunc("/api/networks/{networkname}/keys/{name}", securityCheck(false, http.HandlerFunc(deleteAccessKey))).Methods("DELETE")
+	// ACLs
 	r.HandleFunc("/api/networks/{networkname}/acls", securityCheck(true, http.HandlerFunc(updateNetworkACL))).Methods("PUT")
 	r.HandleFunc("/api/networks/{networkname}/acls", securityCheck(true, http.HandlerFunc(getNetworkACL))).Methods("GET")
-
 }
 
 //simple get all networks function

+ 0 - 20
controllers/node.go

@@ -37,7 +37,6 @@ func nodeHandlers(r *mux.Router) {
 	r.HandleFunc("/api/nodes/adm/{network}/lastmodified", authorize(true, "network", http.HandlerFunc(getLastModified))).Methods("GET")
 	r.HandleFunc("/api/nodes/adm/{network}/authenticate", authenticate).Methods("POST")
 	// ACLs
-	r.HandleFunc("/api/nodes/{network}/{nodeid}/acls", authorize(true, "node", http.HandlerFunc(getNodeACL))).Methods("GET")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/acls", authorize(true, "node", http.HandlerFunc(updateNodeACL))).Methods("PUT")
 }
 
@@ -343,25 +342,6 @@ func getNode(w http.ResponseWriter, r *http.Request) {
 	json.NewEncoder(w).Encode(node)
 }
 
-// Get an individual node. Nothin fancy here folks.
-func getNodeACL(w http.ResponseWriter, r *http.Request) {
-	// set header.
-	w.Header().Set("Content-Type", "application/json")
-
-	var params = mux.Vars(r)
-	var nodeID = params["nodeid"]
-	var networkID = params["network"]
-
-	nodeACL, err := nodeacls.FetchNodeACL(nodeacls.NetworkID(networkID), nodeacls.NodeID(nodeID))
-	if err != nil {
-		returnErrorResponse(w, r, formatError(err, "notfound"))
-		return
-	}
-	logger.Log(2, r.Header.Get("user"), "fetched node ACL", params["nodeid"])
-	w.WriteHeader(http.StatusOK)
-	json.NewEncoder(w).Encode(nodeACL)
-}
-
 //Get the time that a network of nodes was last modified.
 //TODO: This needs to be refactored
 //Potential way to do this: On UpdateNode, set a new field for "LastModified"