mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
removed unneccasy api exposure
This commit is contained in:
@@ -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(createAccessKey))).Methods("POST")
|
||||||
r.HandleFunc("/api/networks/{networkname}/keys", securityCheck(false, http.HandlerFunc(getAccessKeys))).Methods("GET")
|
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")
|
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(updateNetworkACL))).Methods("PUT")
|
||||||
r.HandleFunc("/api/networks/{networkname}/acls", securityCheck(true, http.HandlerFunc(getNetworkACL))).Methods("GET")
|
r.HandleFunc("/api/networks/{networkname}/acls", securityCheck(true, http.HandlerFunc(getNetworkACL))).Methods("GET")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//simple get all networks function
|
//simple get all networks function
|
||||||
|
@@ -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"
|
||||||
|
Reference in New Issue
Block a user