From 1816d6ccb6d7144fda8b2482c8d38349c8be6a09 Mon Sep 17 00:00:00 2001 From: Chris Norman <17420369+chrnorm@users.noreply.github.com> Date: Mon, 22 Jul 2024 03:00:34 +0100 Subject: [PATCH] add department attribute to user (#203) * add department attribute to user * add integration type okta to directory --- .changeset/popular-badgers-train.md | 5 ++ .changeset/tidy-roses-attend.md | 5 ++ .../directory/v1alpha1/integration.pb.go | 52 ++++++++++--------- .../control/directory/v1alpha1/user.pb.go | 16 ++++-- .../directory/v1alpha1/user.pb.validate.go | 2 + .../directory/v1alpha1/integration.proto | 1 + .../control/directory/v1alpha1/user.proto | 2 + 7 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 .changeset/popular-badgers-train.md create mode 100644 .changeset/tidy-roses-attend.md diff --git a/.changeset/popular-badgers-train.md b/.changeset/popular-badgers-train.md new file mode 100644 index 00000000..fc0cbd2d --- /dev/null +++ b/.changeset/popular-badgers-train.md @@ -0,0 +1,5 @@ +--- +"@common-fate/sdk": minor +--- + +Add Department attribute to User diff --git a/.changeset/tidy-roses-attend.md b/.changeset/tidy-roses-attend.md new file mode 100644 index 00000000..dc7a1e03 --- /dev/null +++ b/.changeset/tidy-roses-attend.md @@ -0,0 +1,5 @@ +--- +"@common-fate/sdk": minor +--- + +Directory: adds Okta integration type diff --git a/gen/commonfate/control/directory/v1alpha1/integration.pb.go b/gen/commonfate/control/directory/v1alpha1/integration.pb.go index 964af51f..7cb2de5d 100644 --- a/gen/commonfate/control/directory/v1alpha1/integration.pb.go +++ b/gen/commonfate/control/directory/v1alpha1/integration.pb.go @@ -28,6 +28,7 @@ const ( IntegrationType_INTEGRATION_TYPE_AWS_IAM_IDENTITY_CENTER IntegrationType = 2 IntegrationType_INTEGRATION_TYPE_SLACK IntegrationType = 3 IntegrationType_INTEGRATION_TYPE_PAGERDUTY IntegrationType = 4 + IntegrationType_INTEGRATION_TYPE_OKTA IntegrationType = 5 ) // Enum value maps for IntegrationType. @@ -38,6 +39,7 @@ var ( 2: "INTEGRATION_TYPE_AWS_IAM_IDENTITY_CENTER", 3: "INTEGRATION_TYPE_SLACK", 4: "INTEGRATION_TYPE_PAGERDUTY", + 5: "INTEGRATION_TYPE_OKTA", } IntegrationType_value = map[string]int32{ "INTEGRATION_TYPE_UNSPECIFIED": 0, @@ -45,6 +47,7 @@ var ( "INTEGRATION_TYPE_AWS_IAM_IDENTITY_CENTER": 2, "INTEGRATION_TYPE_SLACK": 3, "INTEGRATION_TYPE_PAGERDUTY": 4, + "INTEGRATION_TYPE_OKTA": 5, } ) @@ -155,7 +158,7 @@ var file_commonfate_control_directory_v1alpha1_integration_proto_rawDesc = []byt 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, - 0xb9, 0x01, 0x0a, 0x0f, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0xd4, 0x01, 0x0a, 0x0f, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x1c, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x52, 0x41, @@ -166,29 +169,30 @@ var file_commonfate_control_directory_v1alpha1_integration_proto_rawDesc = []byt 0x1a, 0x0a, 0x16, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x50, 0x41, 0x47, 0x45, 0x52, 0x44, 0x55, 0x54, 0x59, 0x10, 0x04, 0x42, 0xce, 0x02, 0x0a, 0x29, - 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x49, 0x6e, 0x74, 0x65, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x56, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2d, 0x66, 0x61, 0x74, 0x65, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x3b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, 0x44, 0xaa, 0x02, 0x25, 0x43, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0xca, 0x02, 0x26, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, - 0x5c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5c, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x5f, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x32, 0x43, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x5c, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x5c, 0x56, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x28, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x3a, 0x3a, - 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x3a, 0x3a, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x50, 0x41, 0x47, 0x45, 0x52, 0x44, 0x55, 0x54, 0x59, 0x10, 0x04, 0x12, 0x19, 0x0a, 0x15, 0x49, + 0x4e, 0x54, 0x45, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x4f, 0x4b, 0x54, 0x41, 0x10, 0x05, 0x42, 0xce, 0x02, 0x0a, 0x29, 0x63, 0x6f, 0x6d, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x2e, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x56, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2d, 0x66, 0x61, 0x74, 0x65, + 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, + 0x61, 0x74, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x64, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xa2, 0x02, 0x03, 0x43, 0x43, 0x44, 0xaa, 0x02, 0x25, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, + 0x61, 0x74, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x44, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, + 0x26, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x5c, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x5c, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x32, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x66, 0x61, 0x74, 0x65, 0x5c, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5c, 0x44, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x28, 0x43, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x3a, 0x3a, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x3a, 0x3a, 0x56, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/gen/commonfate/control/directory/v1alpha1/user.pb.go b/gen/commonfate/control/directory/v1alpha1/user.pb.go index 49234df7..040496c5 100644 --- a/gen/commonfate/control/directory/v1alpha1/user.pb.go +++ b/gen/commonfate/control/directory/v1alpha1/user.pb.go @@ -37,7 +37,8 @@ type User struct { // If nil, the user has never authenticated. LastAuthenticatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_authenticated_at,json=lastAuthenticatedAt,proto3" json:"last_authenticated_at,omitempty"` // The number of groups the user belongs to. - GroupMembershipCount int32 `protobuf:"varint,6,opt,name=group_membership_count,json=groupMembershipCount,proto3" json:"group_membership_count,omitempty"` + GroupMembershipCount int32 `protobuf:"varint,6,opt,name=group_membership_count,json=groupMembershipCount,proto3" json:"group_membership_count,omitempty"` + Department string `protobuf:"bytes,7,opt,name=department,proto3" json:"department,omitempty"` } func (x *User) Reset() { @@ -114,6 +115,13 @@ func (x *User) GetGroupMembershipCount() int32 { return 0 } +func (x *User) GetDepartment() string { + if x != nil { + return x.Department + } + return "" +} + type UserAccount struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -197,7 +205,7 @@ var file_commonfate_control_directory_v1alpha1_user_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x66, 0x61, 0x74, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, + 0x6f, 0x74, 0x6f, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, @@ -214,7 +222,9 @@ var file_commonfate_control_directory_v1alpha1_user_proto_rawDesc = []byte{ 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x34, 0x0a, 0x16, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x87, 0x01, 0x0a, + 0x62, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, + 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x87, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, diff --git a/gen/commonfate/control/directory/v1alpha1/user.pb.validate.go b/gen/commonfate/control/directory/v1alpha1/user.pb.validate.go index 047a8fc1..9bb2845b 100644 --- a/gen/commonfate/control/directory/v1alpha1/user.pb.validate.go +++ b/gen/commonfate/control/directory/v1alpha1/user.pb.validate.go @@ -127,6 +127,8 @@ func (m *User) validate(all bool) error { // no validation rules for GroupMembershipCount + // no validation rules for Department + if len(errors) > 0 { return UserMultiError(errors) } diff --git a/proto/commonfate/control/directory/v1alpha1/integration.proto b/proto/commonfate/control/directory/v1alpha1/integration.proto index ef1844bc..d7995e18 100644 --- a/proto/commonfate/control/directory/v1alpha1/integration.proto +++ b/proto/commonfate/control/directory/v1alpha1/integration.proto @@ -14,4 +14,5 @@ enum IntegrationType { INTEGRATION_TYPE_AWS_IAM_IDENTITY_CENTER = 2; INTEGRATION_TYPE_SLACK = 3; INTEGRATION_TYPE_PAGERDUTY = 4; + INTEGRATION_TYPE_OKTA = 5; } diff --git a/proto/commonfate/control/directory/v1alpha1/user.proto b/proto/commonfate/control/directory/v1alpha1/user.proto index a4df4a44..6a99f265 100644 --- a/proto/commonfate/control/directory/v1alpha1/user.proto +++ b/proto/commonfate/control/directory/v1alpha1/user.proto @@ -21,6 +21,8 @@ message User { // The number of groups the user belongs to. int32 group_membership_count = 6; + + string department = 7; } message UserAccount {