mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
1a1ba1ccf4
* Move ee code to ee package and unify ee status to IsPro * Consolidate naming for paid/professional/enterprise version as "pro". Notes: - Changes image tags - Changes build tags - Changes package names - Doesn't change links to docs that mention "ee" - Doesn't change parameters sent to PostHog that mention "ee" * Revert docker image tag being -pro, back to -ee * Revert go build tag being pro, back to ee * Add build tags for some ee content * [2] Revert go build tag being pro, back to ee * Fix test workflow * Add a json tag to be backwards compatible with frontend "IsEE" check * Add a json tag for the serverconfig struct for IsEE * Ammend json tag to Is_EE * fix ee tags --------- Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package logic
|
|
|
|
import (
|
|
"errors"
|
|
"sort"
|
|
|
|
"github.com/gravitl/netmaker/models"
|
|
)
|
|
|
|
// functions defined here, handle client ACLs, should be set on ee
|
|
|
|
var (
|
|
// DenyClientNodeAccess - function to handle adding a node to an ext client's denied node set
|
|
DenyClientNodeAccess = func(ec *models.ExtClient, clientOrNodeID string) bool {
|
|
return true
|
|
}
|
|
// IsClientNodeAllowed - function to check if an ext client's denied node set contains a node ID
|
|
IsClientNodeAllowed = func(ec *models.ExtClient, clientOrNodeID string) bool {
|
|
return true
|
|
}
|
|
// AllowClientNodeAccess - function to handle removing a node ID from ext client's denied nodes, thus allowing it
|
|
AllowClientNodeAccess = func(ec *models.ExtClient, clientOrNodeID string) bool {
|
|
return true
|
|
}
|
|
SetClientDefaultACLs = func(ec *models.ExtClient) error {
|
|
return nil
|
|
}
|
|
SetClientACLs = func(ec *models.ExtClient, newACLs map[string]struct{}) {
|
|
}
|
|
UpdateProNodeACLs = func(node *models.Node) error {
|
|
return nil
|
|
}
|
|
)
|
|
|
|
// SortExtClient - Sorts slice of ExtClients by their ClientID alphabetically with numbers first
|
|
func SortExtClient(unsortedExtClient []models.ExtClient) {
|
|
sort.Slice(unsortedExtClient, func(i, j int) bool {
|
|
return unsortedExtClient[i].ClientID < unsortedExtClient[j].ClientID
|
|
})
|
|
}
|
|
|
|
// GetExtClientByName - gets an ext client by name
|
|
func GetExtClientByName(ID string) (models.ExtClient, error) {
|
|
clients, err := GetAllExtClients()
|
|
if err != nil {
|
|
return models.ExtClient{}, err
|
|
}
|
|
for i := range clients {
|
|
if clients[i].ClientID == ID {
|
|
return clients[i], nil
|
|
}
|
|
}
|
|
return models.ExtClient{}, errors.New("client not found")
|
|
}
|