|
@@ -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}/lastmodified", authorize(true, "network", http.HandlerFunc(getLastModified))).Methods("GET")
|
|
r.HandleFunc("/api/nodes/adm/{network}/authenticate", authenticate).Methods("POST")
|
|
r.HandleFunc("/api/nodes/adm/{network}/authenticate", authenticate).Methods("POST")
|
|
// ACLs
|
|
// 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")
|
|
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)
|
|
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.
|
|
//Get the time that a network of nodes was last modified.
|
|
//TODO: This needs to be refactored
|
|
//TODO: This needs to be refactored
|
|
//Potential way to do this: On UpdateNode, set a new field for "LastModified"
|
|
//Potential way to do this: On UpdateNode, set a new field for "LastModified"
|