Skip to content

Commit ba37619

Browse files
authored
fix: directorysync.UserGroup: add missing fields (#480)
1 parent 5de4629 commit ba37619

File tree

3 files changed

+108
-30
lines changed

3 files changed

+108
-30
lines changed

pkg/directorysync/client.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@ type UserGroup struct {
7474

7575
// The Group's Name.
7676
Name string
77+
78+
// The Group's unique identifier assigned by the Directory Provider.
79+
IdpID string `json:"idp_id"`
80+
81+
// The identifier of the Directory the group belongs to.
82+
DirectoryID string `json:"directory_id"`
83+
84+
// The identifier for the Organization in which the Directory resides.
85+
OrganizationID string `json:"organization_id"`
86+
87+
// The Group's created at date.
88+
CreatedAt string `json:"created_at"`
89+
90+
// The Group's updated at date.
91+
UpdatedAt string `json:"updated_at"`
92+
93+
// The Group's raw attributes in raw encoded JSON.
94+
RawAttributes json.RawMessage `json:"raw_attributes"`
7795
}
7896

7997
// UserState represents the active state of a Directory User.

pkg/directorysync/client_test.go

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ func TestListUsers(t *testing.T) {
5050
},
5151
Groups: []UserGroup{
5252
UserGroup{
53-
Object: "user_group_object",
54-
ID: "directory_group_123",
55-
Name: "Group Name",
53+
Object: "user_group_object",
54+
ID: "directory_group_123",
55+
Name: "Group Name",
56+
IdpID: "123",
57+
DirectoryID: "456",
58+
OrganizationID: "789",
59+
CreatedAt: "2022-06-08T17:05:58.051Z",
60+
UpdatedAt: "2022-06-08T17:05:58.051Z",
61+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
5662
},
5763
},
5864
State: Active,
@@ -127,9 +133,15 @@ func listUsersTestHandler(w http.ResponseWriter, r *http.Request) {
127133
},
128134
Groups: []UserGroup{
129135
UserGroup{
130-
Object: "user_group_object",
131-
ID: "directory_group_123",
132-
Name: "Group Name",
136+
Object: "user_group_object",
137+
ID: "directory_group_123",
138+
Name: "Group Name",
139+
IdpID: "123",
140+
DirectoryID: "456",
141+
OrganizationID: "789",
142+
CreatedAt: "2022-06-08T17:05:58.051Z",
143+
UpdatedAt: "2022-06-08T17:05:58.051Z",
144+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
133145
},
134146
},
135147
State: Active,
@@ -298,9 +310,15 @@ func TestGetUser(t *testing.T) {
298310
},
299311
Groups: []UserGroup{
300312
UserGroup{
301-
Object: "user_group_object",
302-
ID: "directory_group_123",
303-
Name: "Group Name",
313+
Object: "user_group_object",
314+
ID: "directory_group_123",
315+
Name: "Group Name",
316+
IdpID: "123",
317+
DirectoryID: "456",
318+
OrganizationID: "789",
319+
CreatedAt: "2022-06-08T17:05:58.051Z",
320+
UpdatedAt: "2022-06-08T17:05:58.051Z",
321+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
304322
},
305323
},
306324
State: Active,
@@ -362,9 +380,15 @@ func getUserTestHandler(w http.ResponseWriter, r *http.Request) {
362380
},
363381
Groups: []UserGroup{
364382
UserGroup{
365-
Object: "user_group_object",
366-
ID: "directory_group_123",
367-
Name: "Group Name",
383+
Object: "user_group_object",
384+
ID: "directory_group_123",
385+
Name: "Group Name",
386+
IdpID: "123",
387+
DirectoryID: "456",
388+
OrganizationID: "789",
389+
CreatedAt: "2022-06-08T17:05:58.051Z",
390+
UpdatedAt: "2022-06-08T17:05:58.051Z",
391+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
368392
},
369393
},
370394
State: Active,

pkg/directorysync/directorysync_test.go

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ func TestDirectorySyncListUsers(t *testing.T) {
4242
},
4343
Groups: []UserGroup{
4444
UserGroup{
45-
Object: "user_group_object",
46-
ID: "directory_group_123",
47-
Name: "Group Name",
45+
Object: "user_group_object",
46+
ID: "directory_group_123",
47+
Name: "Group Name",
48+
IdpID: "123",
49+
DirectoryID: "456",
50+
OrganizationID: "789",
51+
CreatedAt: "2022-06-08T17:05:58.051Z",
52+
UpdatedAt: "2022-06-08T17:05:58.051Z",
53+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
4854
},
4955
},
5056
State: Active,
@@ -138,9 +144,15 @@ func TestDirectorySyncGetUser(t *testing.T) {
138144
},
139145
Groups: []UserGroup{
140146
UserGroup{
141-
Object: "user_group_object",
142-
ID: "directory_group_123",
143-
Name: "Group Name",
147+
Object: "user_group_object",
148+
ID: "directory_group_123",
149+
Name: "Group Name",
150+
IdpID: "123",
151+
DirectoryID: "456",
152+
OrganizationID: "789",
153+
CreatedAt: "2022-06-08T17:05:58.051Z",
154+
UpdatedAt: "2022-06-08T17:05:58.051Z",
155+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
144156
},
145157
},
146158
State: Active,
@@ -342,9 +354,15 @@ func TestPrimaryEmail(t *testing.T) {
342354
},
343355
Groups: []UserGroup{
344356
UserGroup{
345-
Object: "user_group_object",
346-
ID: "directory_group_123",
347-
Name: "Group Name",
357+
Object: "user_group_object",
358+
ID: "directory_group_123",
359+
Name: "Group Name",
360+
IdpID: "123",
361+
DirectoryID: "456",
362+
OrganizationID: "789",
363+
CreatedAt: "2022-06-08T17:05:58.051Z",
364+
UpdatedAt: "2022-06-08T17:05:58.051Z",
365+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
348366
},
349367
},
350368
State: Active,
@@ -374,9 +392,15 @@ func TestPrimaryEmail(t *testing.T) {
374392
},
375393
Groups: []UserGroup{
376394
UserGroup{
377-
Object: "user_group_object",
378-
ID: "directory_group_123",
379-
Name: "Group Name",
395+
Object: "user_group_object",
396+
ID: "directory_group_123",
397+
Name: "Group Name",
398+
IdpID: "123",
399+
DirectoryID: "456",
400+
OrganizationID: "789",
401+
CreatedAt: "2022-06-08T17:05:58.051Z",
402+
UpdatedAt: "2022-06-08T17:05:58.051Z",
403+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
380404
},
381405
},
382406
State: Active,
@@ -399,9 +423,15 @@ func TestPrimaryEmail(t *testing.T) {
399423
},
400424
Groups: []UserGroup{
401425
UserGroup{
402-
Object: "user_group_object",
403-
ID: "directory_group_123",
404-
Name: "Group Name",
426+
Object: "user_group_object",
427+
ID: "directory_group_123",
428+
Name: "Group Name",
429+
IdpID: "123",
430+
DirectoryID: "456",
431+
OrganizationID: "789",
432+
CreatedAt: "2022-06-08T17:05:58.051Z",
433+
UpdatedAt: "2022-06-08T17:05:58.051Z",
434+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
405435
},
406436
},
407437
State: Active,
@@ -418,9 +448,15 @@ func TestPrimaryEmail(t *testing.T) {
418448
LastName: "Testz",
419449
Groups: []UserGroup{
420450
UserGroup{
421-
Object: "user_group_object",
422-
ID: "directory_group_123",
423-
Name: "Group Name",
451+
Object: "user_group_object",
452+
ID: "directory_group_123",
453+
Name: "Group Name",
454+
IdpID: "123",
455+
DirectoryID: "456",
456+
OrganizationID: "789",
457+
CreatedAt: "2022-06-08T17:05:58.051Z",
458+
UpdatedAt: "2022-06-08T17:05:58.051Z",
459+
RawAttributes: json.RawMessage(`{"foo":"bar"}`),
424460
},
425461
},
426462
State: Active,

0 commit comments

Comments
 (0)