removed unneccasy api exposure

This commit is contained in:
0xdcarns 2022-03-04 10:46:46 -05:00
parent 2e43facb8b
commit 03d35528cc
2 changed files with 1 additions and 21 deletions

View file

@ -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

View file

@ -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"