mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
hotfixes for repo. Now works.
This commit is contained in:
@@ -150,8 +150,14 @@ func authorize(groupCheck bool, authGroup string, next http.Handler) http.Handle
|
||||
|
||||
if len(tokenSplit) > 1 {
|
||||
authToken = tokenSplit[1]
|
||||
} else {
|
||||
errorResponse = models.ErrorResponse{
|
||||
Code: http.StatusUnauthorized, Message: "W1R3: Missing Auth Token.",
|
||||
}
|
||||
returnErrorResponse(w, r, errorResponse)
|
||||
}
|
||||
|
||||
|
||||
//This checks if
|
||||
//A: the token is the master password
|
||||
//B: the token corresponds to a mac address, and if so, which one
|
||||
@@ -159,7 +165,10 @@ func authorize(groupCheck bool, authGroup string, next http.Handler) http.Handle
|
||||
macaddress, _, err := functions.VerifyToken(authToken)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
errorResponse = models.ErrorResponse{
|
||||
Code: http.StatusUnauthorized, Message: "W1R3: Error Verifying Auth Token.",
|
||||
}
|
||||
returnErrorResponse(w, r, errorResponse)
|
||||
}
|
||||
|
||||
var isAuthorized = false
|
||||
@@ -179,7 +188,10 @@ func authorize(groupCheck bool, authGroup string, next http.Handler) http.Handle
|
||||
case "group":
|
||||
node, err := functions.GetNodeByMacAddress(params["group"], macaddress)
|
||||
if err != nil {
|
||||
return
|
||||
errorResponse = models.ErrorResponse{
|
||||
Code: http.StatusUnauthorized, Message: "W1R3: Missing Auth Token.",
|
||||
}
|
||||
returnErrorResponse(w, r, errorResponse)
|
||||
}
|
||||
isAuthorized = (node.Group == params["group"])
|
||||
case "node":
|
||||
@@ -567,6 +579,8 @@ func uncordonNode(w http.ResponseWriter, r *http.Request) {
|
||||
mongoconn.GetError(errN, w)
|
||||
return
|
||||
}
|
||||
fmt.Println("Node " + node.Name + " uncordoned.")
|
||||
|
||||
|
||||
json.NewEncoder(w).Encode("SUCCESS")
|
||||
}
|
||||
|
Reference in New Issue
Block a user