mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-27 17:42:57 +08:00
Merge pull request #563 from gravitl/bugfix_v0.9.3_user_deletes
Bugfix v0.9.3 user deletes
This commit is contained in:
commit
40fcf78e31
7 changed files with 17 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,3 +15,4 @@ netclient/netclient32
|
||||||
netclient/netclient.exe
|
netclient/netclient.exe
|
||||||
config/dnsconfig/
|
config/dnsconfig/
|
||||||
data/
|
data/
|
||||||
|
.vscode/
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/gravitl/netmaker/logger"
|
"github.com/gravitl/netmaker/logger"
|
||||||
"github.com/gravitl/netmaker/logic"
|
"github.com/gravitl/netmaker/logic"
|
||||||
|
@ -36,7 +35,7 @@ func initAzureAD(redirectURL string, clientID string, clientSecret string) {
|
||||||
ClientID: clientID,
|
ClientID: clientID,
|
||||||
ClientSecret: clientSecret,
|
ClientSecret: clientSecret,
|
||||||
Scopes: []string{"User.Read"},
|
Scopes: []string{"User.Read"},
|
||||||
Endpoint: microsoft.AzureADEndpoint(os.Getenv("AZURE_TENANT")),
|
Endpoint: microsoft.AzureADEndpoint(servercfg.GetAzureTenant()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ type ServerConfig struct {
|
||||||
ClientSecret string `yaml:"clientsecret"`
|
ClientSecret string `yaml:"clientsecret"`
|
||||||
FrontendURL string `yaml:"frontendurl"`
|
FrontendURL string `yaml:"frontendurl"`
|
||||||
DisplayKeys string `yaml:"displaykeys"`
|
DisplayKeys string `yaml:"displaykeys"`
|
||||||
|
AzureTenant string `yaml:"azuretenant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic SQL Config
|
// Generic SQL Config
|
||||||
|
|
|
@ -23,7 +23,7 @@ func userHandlers(r *mux.Router) {
|
||||||
r.HandleFunc("/api/users/networks/{username}", securityCheck(true, http.HandlerFunc(updateUserNetworks))).Methods("PUT")
|
r.HandleFunc("/api/users/networks/{username}", securityCheck(true, http.HandlerFunc(updateUserNetworks))).Methods("PUT")
|
||||||
r.HandleFunc("/api/users/{username}/adm", securityCheck(true, http.HandlerFunc(updateUserAdm))).Methods("PUT")
|
r.HandleFunc("/api/users/{username}/adm", securityCheck(true, http.HandlerFunc(updateUserAdm))).Methods("PUT")
|
||||||
r.HandleFunc("/api/users/{username}", securityCheck(true, http.HandlerFunc(createUser))).Methods("POST")
|
r.HandleFunc("/api/users/{username}", securityCheck(true, http.HandlerFunc(createUser))).Methods("POST")
|
||||||
r.HandleFunc("/api/users/{username}", securityCheck(false, continueIfUserMatch(http.HandlerFunc(deleteUser)))).Methods("DELETE")
|
r.HandleFunc("/api/users/{username}", securityCheck(true, http.HandlerFunc(deleteUser))).Methods("DELETE")
|
||||||
r.HandleFunc("/api/users/{username}", securityCheck(false, continueIfUserMatch(http.HandlerFunc(getUser)))).Methods("GET")
|
r.HandleFunc("/api/users/{username}", securityCheck(false, continueIfUserMatch(http.HandlerFunc(getUser)))).Methods("GET")
|
||||||
r.HandleFunc("/api/users", securityCheck(true, http.HandlerFunc(getUsers))).Methods("GET")
|
r.HandleFunc("/api/users", securityCheck(true, http.HandlerFunc(getUsers))).Methods("GET")
|
||||||
r.HandleFunc("/api/oauth/login", auth.HandleAuthLogin).Methods("GET")
|
r.HandleFunc("/api/oauth/login", auth.HandleAuthLogin).Methods("GET")
|
||||||
|
|
1
go.mod
1
go.mod
|
@ -31,6 +31,7 @@ require (
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go v0.34.0 // indirect
|
cloud.google.com/go v0.34.0 // indirect
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/felixge/httpsnoop v1.0.1 // indirect
|
github.com/felixge/httpsnoop v1.0.1 // indirect
|
||||||
github.com/go-playground/locales v0.14.0 // indirect
|
github.com/go-playground/locales v0.14.0 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.0 // indirect
|
github.com/go-playground/universal-translator v0.18.0 // indirect
|
||||||
|
|
2
main.go
2
main.go
|
@ -43,7 +43,7 @@ func initialize() { // Client Mode Prereq Check
|
||||||
|
|
||||||
var authProvider = auth.InitializeAuthProvider()
|
var authProvider = auth.InitializeAuthProvider()
|
||||||
if authProvider != "" {
|
if authProvider != "" {
|
||||||
logger.Log(0, "OAuth provider, ", authProvider, ", initialized")
|
logger.Log(0, "OAuth provider,", authProvider+",", "initialized")
|
||||||
} else {
|
} else {
|
||||||
logger.Log(0, "no OAuth provider found or not configured, continuing without OAuth")
|
logger.Log(0, "no OAuth provider found or not configured, continuing without OAuth")
|
||||||
}
|
}
|
||||||
|
|
|
@ -502,6 +502,17 @@ func GetAuthProviderInfo() []string {
|
||||||
return []string{"", "", ""}
|
return []string{"", "", ""}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAzureTenant - retrieve the azure tenant ID from env variable or config file
|
||||||
|
func GetAzureTenant() string {
|
||||||
|
var azureTenant = ""
|
||||||
|
if os.Getenv("AZURE_TENANT") != "" {
|
||||||
|
azureTenant = os.Getenv("AZURE_TENANT")
|
||||||
|
} else if config.Config.Server.AzureTenant != "" {
|
||||||
|
azureTenant = config.Config.Server.AzureTenant
|
||||||
|
}
|
||||||
|
return azureTenant
|
||||||
|
}
|
||||||
|
|
||||||
// GetMacAddr - get's mac address
|
// GetMacAddr - get's mac address
|
||||||
func getMacAddr() string {
|
func getMacAddr() string {
|
||||||
ifas, err := net.Interfaces()
|
ifas, err := net.Interfaces()
|
||||||
|
|
Loading…
Reference in a new issue