mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-06 13:14:24 +08:00
Merge branch 'develop' into dependabot/go_modules/develop/github.com/olekukonko/tablewriter-1.0.7
This commit is contained in:
commit
eb9e99e0a5
4 changed files with 42 additions and 5 deletions
|
@ -247,7 +247,10 @@ func getConfig(w http.ResponseWriter, r *http.Request) {
|
|||
// @Success 200 {object} config.ServerSettings
|
||||
func getSettings(w http.ResponseWriter, r *http.Request) {
|
||||
scfg := logic.GetServerSettings()
|
||||
scfg.ClientSecret = logic.Mask()
|
||||
if scfg.ClientSecret != "" {
|
||||
scfg.ClientSecret = logic.Mask()
|
||||
}
|
||||
|
||||
logic.ReturnSuccessResponseWithJson(w, r, scfg, "fetched server settings successfully")
|
||||
}
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -15,7 +15,7 @@ require (
|
|||
github.com/lib/pq v1.10.9
|
||||
github.com/mattn/go-sqlite3 v1.14.28
|
||||
github.com/rqlite/gorqlite v0.0.0-20240122221808-a8a425b1a6aa
|
||||
github.com/seancfoley/ipaddress-go v1.7.0
|
||||
github.com/seancfoley/ipaddress-go v1.7.1
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/txn2/txeh v1.5.5
|
||||
|
|
4
go.sum
4
go.sum
|
@ -132,8 +132,8 @@ github.com/rqlite/gorqlite v0.0.0-20240122221808-a8a425b1a6aa/go.mod h1:xF/KoXmr
|
|||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/seancfoley/bintree v1.3.1 h1:cqmmQK7Jm4aw8gna0bP+huu5leVOgHGSJBEpUx3EXGI=
|
||||
github.com/seancfoley/bintree v1.3.1/go.mod h1:hIUabL8OFYyFVTQ6azeajbopogQc2l5C/hiXMcemWNU=
|
||||
github.com/seancfoley/ipaddress-go v1.7.0 h1:vWp3SR3k+HkV3aKiNO2vEe6xbVxS0x/Ixw6hgyP238s=
|
||||
github.com/seancfoley/ipaddress-go v1.7.0/go.mod h1:TQRZgv+9jdvzHmKoPGBMxyiaVmoI0rYpfEk8Q/sL/Iw=
|
||||
github.com/seancfoley/ipaddress-go v1.7.1 h1:fDWryS+L8iaaH5RxIKbY0xB5Z+Zxk8xoXLN4S4eAPdQ=
|
||||
github.com/seancfoley/ipaddress-go v1.7.1/go.mod h1:TQRZgv+9jdvzHmKoPGBMxyiaVmoI0rYpfEk8Q/sL/Iw=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
||||
|
|
|
@ -2,6 +2,8 @@ package logic
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gravitl/netmaker/database"
|
||||
"github.com/gravitl/netmaker/models"
|
||||
|
@ -60,7 +62,39 @@ var InitialiseRoles = userRolesInit
|
|||
var IntialiseGroups = func() {}
|
||||
var DeleteNetworkRoles = func(netID string) {}
|
||||
var CreateDefaultNetworkRolesAndGroups = func(netID models.NetworkID) {}
|
||||
var CreateDefaultUserPolicies = func(netID models.NetworkID) {}
|
||||
var CreateDefaultUserPolicies = func(netID models.NetworkID) {
|
||||
if netID.String() == "" {
|
||||
return
|
||||
}
|
||||
if !IsAclExists(fmt.Sprintf("%s.%s", netID, "all-users")) {
|
||||
defaultUserAcl := models.Acl{
|
||||
ID: fmt.Sprintf("%s.%s", netID, "all-users"),
|
||||
Default: true,
|
||||
Name: "All Users",
|
||||
MetaData: "This policy gives access to everything in the network for an user",
|
||||
NetworkID: netID,
|
||||
Proto: models.ALL,
|
||||
ServiceType: models.Any,
|
||||
Port: []string{},
|
||||
RuleType: models.UserPolicy,
|
||||
Src: []models.AclPolicyTag{
|
||||
{
|
||||
ID: models.UserAclID,
|
||||
Value: "*",
|
||||
},
|
||||
},
|
||||
Dst: []models.AclPolicyTag{{
|
||||
ID: models.NodeTagID,
|
||||
Value: "*",
|
||||
}},
|
||||
AllowedDirection: models.TrafficDirectionUni,
|
||||
Enabled: true,
|
||||
CreatedBy: "auto",
|
||||
CreatedAt: time.Now().UTC(),
|
||||
}
|
||||
InsertAcl(defaultUserAcl)
|
||||
}
|
||||
}
|
||||
var GetUserGroupsInNetwork = func(netID models.NetworkID) (networkGrps map[models.UserGroupID]models.UserGroup) { return }
|
||||
var GetUserGroup = func(groupId models.UserGroupID) (userGrps models.UserGroup, err error) { return }
|
||||
var AddGlobalNetRolesToAdmins = func(u *models.User) {}
|
||||
|
|
Loading…
Add table
Reference in a new issue