fix issue with pve group creation appending unused realm string

This commit is contained in:
2026-03-29 17:51:59 +00:00
parent a1a18af016
commit 97bd582505
5 changed files with 10 additions and 4 deletions

View File

@@ -9,7 +9,10 @@ type Pool struct {
Templates Templates `json:"templates"`
}
type Groupname struct { // proxmox typically formats as gid-realm for non pve realms
// proxmox typically formats as gid-realm for non pve realms
// proxmox realms are formatted without realm values
// I assume that backends store groups by ID only and only proxmox will append the realm string
type Groupname struct {
GroupID string `json:"gid"`
Realm string `json:"realm"`
}

View File

@@ -6,6 +6,8 @@ import (
)
// returns an error if the groupname format was not correct
// TODO: handle group names with x-y format where y is not a registered realm
// TODO: handle group names with x-y-z-... format
func ParseGroupname(groupname string) (Groupname, error) {
g := Groupname{}
x := strings.Split(groupname, "-")