mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 01:36:23 +08:00
fixed return and logs
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
* If being deleted by server, create a record in the DELETED_NODES_TABLE for the client to find
|
||||
* If being deleted by the client, delete completely
|
||||
*/
|
||||
// DeleteNode - deletes a node
|
||||
func DeleteNode(key string, exterminate bool) error {
|
||||
var err error
|
||||
if !exterminate {
|
||||
@@ -46,6 +47,7 @@ func DeleteNode(key string, exterminate bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteIntClient - deletes an int client
|
||||
func DeleteIntClient(clientid string) (bool, error) {
|
||||
|
||||
err := database.DeleteRecord(database.INT_CLIENTS_TABLE_NAME, clientid)
|
||||
@@ -56,6 +58,7 @@ func DeleteIntClient(clientid string) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// GetNode - gets a node
|
||||
func GetNode(macaddress string, network string) (models.Node, error) {
|
||||
|
||||
var node models.Node
|
||||
@@ -80,6 +83,7 @@ func GetNode(macaddress string, network string) (models.Node, error) {
|
||||
return node, err
|
||||
}
|
||||
|
||||
// GetIntClient - gets int client
|
||||
func GetIntClient(clientid string) (models.IntClient, error) {
|
||||
|
||||
var client models.IntClient
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func loggerHandlers(r *mux.Router) {
|
||||
r.HandleFunc("/api/logs", securityCheckDNS(true, true, http.HandlerFunc(getLogs))).Methods("GET")
|
||||
r.HandleFunc("/api/logs", securityCheck(true, http.HandlerFunc(getLogs))).Methods("GET")
|
||||
}
|
||||
|
||||
func getLogs(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -28,6 +28,7 @@ func securityCheck(reqAdmin bool, next http.Handler) http.HandlerFunc {
|
||||
networks, _ := json.Marshal([]string{ALL_NETWORK_ACCESS})
|
||||
r.Header.Set("networks", string(networks))
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
err, networks, username := SecurityCheck(reqAdmin, params["networkname"], bearerToken)
|
||||
|
Reference in New Issue
Block a user