diff --git a/pkg/directorysync/client.go b/pkg/directorysync/client.go index 6880a39d..fc42f4e7 100644 --- a/pkg/directorysync/client.go +++ b/pkg/directorysync/client.go @@ -74,6 +74,24 @@ type UserGroup struct { // The Group's Name. Name string + + // The Group's unique identifier assigned by the Directory Provider. + IdpID string `json:"idp_id"` + + // The identifier of the Directory the group belongs to. + DirectoryID string `json:"directory_id"` + + // The identifier for the Organization in which the Directory resides. + OrganizationID string `json:"organization_id"` + + // The Group's created at date. + CreatedAt string `json:"created_at"` + + // The Group's updated at date. + UpdatedAt string `json:"updated_at"` + + // The Group's raw attributes in raw encoded JSON. + RawAttributes json.RawMessage `json:"raw_attributes"` } // UserState represents the active state of a Directory User. diff --git a/pkg/directorysync/client_test.go b/pkg/directorysync/client_test.go index bb933e46..28290cc8 100644 --- a/pkg/directorysync/client_test.go +++ b/pkg/directorysync/client_test.go @@ -50,9 +50,15 @@ func TestListUsers(t *testing.T) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -123,9 +129,15 @@ func listUsersTestHandler(w http.ResponseWriter, r *http.Request) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -290,9 +302,15 @@ func TestGetUser(t *testing.T) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -350,9 +368,15 @@ func getUserTestHandler(w http.ResponseWriter, r *http.Request) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, diff --git a/pkg/directorysync/directorysync_test.go b/pkg/directorysync/directorysync_test.go index 810741f2..81b6989d 100644 --- a/pkg/directorysync/directorysync_test.go +++ b/pkg/directorysync/directorysync_test.go @@ -42,9 +42,15 @@ func TestDirectorySyncListUsers(t *testing.T) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -134,9 +140,15 @@ func TestDirectorySyncGetUser(t *testing.T) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -334,9 +346,15 @@ func TestPrimaryEmail(t *testing.T) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -366,9 +384,15 @@ func TestPrimaryEmail(t *testing.T) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -391,9 +415,15 @@ func TestPrimaryEmail(t *testing.T) { }, Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active, @@ -410,9 +440,15 @@ func TestPrimaryEmail(t *testing.T) { LastName: "Testz", Groups: []UserGroup{ UserGroup{ - Object: "user_group_object", - ID: "directory_group_123", - Name: "Group Name", + Object: "user_group_object", + ID: "directory_group_123", + Name: "Group Name", + IdpID: "123", + DirectoryID: "456", + OrganizationID: "789", + CreatedAt: "2022-06-08T17:05:58.051Z", + UpdatedAt: "2022-06-08T17:05:58.051Z", + RawAttributes: json.RawMessage(`{"foo":"bar"}`), }, }, State: Active,