mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-30 03:41:51 +08:00
Merge branch 'bugfix_v0.16.1_ee_checks' of https://github.com/gravitl/netmaker into feature_dyn_sec_latest
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/gravitl/netmaker/database"
|
||||
"github.com/gravitl/netmaker/logic"
|
||||
"github.com/gravitl/netmaker/models"
|
||||
"github.com/gravitl/netmaker/servercfg"
|
||||
)
|
||||
|
||||
// limit consts
|
||||
@@ -22,7 +23,7 @@ func checkFreeTierLimits(limit_choice int, next http.Handler) http.HandlerFunc {
|
||||
Code: http.StatusUnauthorized, Message: "free tier limits exceeded on networks",
|
||||
}
|
||||
|
||||
if logic.Free_Tier && logic.Is_EE { // check that free tier limits not exceeded
|
||||
if logic.Free_Tier && servercfg.Is_EE { // check that free tier limits not exceeded
|
||||
if limit_choice == networks_l {
|
||||
currentNetworks, err := logic.GetNetworks()
|
||||
if (err != nil && !database.IsEmptyRecord(err)) || len(currentNetworks) >= logic.Networks_Limit {
|
||||
|
||||
@@ -94,7 +94,7 @@ func getConfig(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
scfg := servercfg.GetServerConfig()
|
||||
scfg.IsEE = "no"
|
||||
if logic.Is_EE {
|
||||
if servercfg.Is_EE {
|
||||
scfg.IsEE = "yes"
|
||||
}
|
||||
json.NewEncoder(w).Encode(scfg)
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/gravitl/netmaker/logic/pro"
|
||||
"github.com/gravitl/netmaker/models"
|
||||
"github.com/gravitl/netmaker/models/promodels"
|
||||
"github.com/gravitl/netmaker/servercfg"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
@@ -140,7 +141,7 @@ func CreateUser(user models.User) (models.User, error) {
|
||||
|
||||
// legacy
|
||||
if StringSliceContains(user.Networks, currentNets[i].NetID) {
|
||||
if !Is_EE {
|
||||
if !servercfg.Is_EE {
|
||||
newUser.AccessLevel = pro.NET_ADMIN
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func UpdateNode(client mqtt.Client, msg mqtt.Message) {
|
||||
|
||||
// UpdateMetrics message Handler -- handles updates from client nodes for metrics
|
||||
func UpdateMetrics(client mqtt.Client, msg mqtt.Message) {
|
||||
if logic.Is_EE {
|
||||
if servercfg.Is_EE {
|
||||
go func() {
|
||||
id, err := getID(msg.Topic())
|
||||
if err != nil {
|
||||
|
||||
@@ -184,7 +184,7 @@ func ServerStartNotify() error {
|
||||
|
||||
// function to collect and store metrics for server nodes
|
||||
func collectServerMetrics(networks []models.Network) {
|
||||
if !logic.Is_EE {
|
||||
if !servercfg.Is_EE {
|
||||
return
|
||||
}
|
||||
if len(networks) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user