Skip to content

Commit df5b2aa

Browse files
committed
Specifying the type breaks it
1 parent 34eda34 commit df5b2aa

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

pkg/client/group.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ import (
1010
)
1111

1212
type ContextItem struct {
13-
Key string `json:"key"`
14-
Value string `json:"value"`
13+
Key string `json:"key,omitempty"`
14+
Value string `json:"value,omitempty"`
1515
}
1616

1717
type Node struct {
18-
Key string `json:"key"`
19-
Type string `json:"type"`
20-
Value bool `json:"value"`
21-
Expires int64 `json:"expires"`
22-
//Context []map[string]string `json:"context"`
18+
Key string `json:"key,omitempty"`
19+
Type string `json:"type,omitempty"`
20+
Value bool `json:"value,omitempty"`
21+
Expires int64 `json:"expires,omitempty"`
22+
//Context []map[string]string `json:"context,omitempty"`
2323
}
2424

2525
type Group struct {
26-
Name string `json:"name"`
27-
DisplayName string `json:"displayName"`
28-
Nodes []*Node `json:"nodes"`
29-
Metadata map[string]any `json:"metadata"`
26+
Name string `json:"name,omitempty"`
27+
DisplayName string `json:"displayName,omitempty"`
28+
Nodes []*Node `json:"nodes,omitempty"`
29+
Metadata map[string]any `json:"metadata,omitempty"`
3030
}
3131

3232
func (o *Client) GetGroup(ctx context.Context, id string) (*Group, error) {
@@ -91,7 +91,6 @@ func (o *Client) ListAllGroups(ctx context.Context) ([]*Group, error) {
9191
func (o *Client) AddUserToGroup(ctx context.Context, userID string, groupID string, expires *time.Time) (*User, error) {
9292
node := Node{
9393
Key: fmt.Sprintf("group.%s", groupID),
94-
Type: "inheritance",
9594
Value: true,
9695
}
9796
if expires != nil {
@@ -114,8 +113,7 @@ func (o *Client) AddUserToGroup(ctx context.Context, userID string, groupID stri
114113
func (o *Client) RemoveUserFromGroup(ctx context.Context, userID string, groupID string, expires *time.Time) (*User, error) {
115114
node := Node{
116115
Key: fmt.Sprintf("group.%s", groupID),
117-
Type: "inheritance",
118-
Value: true,
116+
Value: false,
119117
}
120118
if expires != nil {
121119
node.Expires = expires.Unix()

0 commit comments

Comments
 (0)