From 5cbf39e08a13d5b78b8d98c2aa57371f21ad2b35 Mon Sep 17 00:00:00 2001 From: michael burton Date: Fri, 8 Mar 2024 12:00:01 -0800 Subject: [PATCH 1/2] Adds support for syncing member roles --- pkg/connector/roles.go | 2 ++ pkg/connector/user.go | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/connector/roles.go b/pkg/connector/roles.go index 21123fa2..6322a112 100644 --- a/pkg/connector/roles.go +++ b/pkg/connector/roles.go @@ -20,6 +20,7 @@ const ( SingleChannelGuestRoleID = "single_channel_guest" InvitedMemberRoleID = "invited_member" BotRoleID = "bot" + MemberRoleID = "member" RoleAssignmentEntitlement = "assigned" ) @@ -32,6 +33,7 @@ var roles = map[string]string{ SingleChannelGuestRoleID: "Single Channel Guest", InvitedMemberRoleID: "Invited member", BotRoleID: "Bot", + MemberRoleID: "Member", } type workspaceRoleType struct { diff --git a/pkg/connector/user.go b/pkg/connector/user.go index 9e94203b..f9c12341 100644 --- a/pkg/connector/user.go +++ b/pkg/connector/user.go @@ -89,6 +89,15 @@ func (o *userResourceType) Grants(ctx context.Context, resource *v2.Resource, pt userRoles = append(userRoles, rr) } + if !user.IsRestricted && !user.IsUltraRestricted && !user.IsInvitedUser && !user.IsStranger { + rr, err := roleResource(MemberRoleID, resource.ParentResourceId) + if err != nil { + return nil, "", nil, err + } + userRoles = append(userRoles, rr) + + } + if user.IsRestricted { if user.IsUltraRestricted { rr, err := roleResource(SingleChannelGuestRoleID, resource.ParentResourceId) From 62424589f14860ede38233529519ec3e9c568aa5 Mon Sep 17 00:00:00 2001 From: michael burton Date: Fri, 8 Mar 2024 12:05:03 -0800 Subject: [PATCH 2/2] lint --- pkg/connector/user.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/connector/user.go b/pkg/connector/user.go index f9c12341..6b12fddf 100644 --- a/pkg/connector/user.go +++ b/pkg/connector/user.go @@ -95,7 +95,6 @@ func (o *userResourceType) Grants(ctx context.Context, resource *v2.Resource, pt return nil, "", nil, err } userRoles = append(userRoles, rr) - } if user.IsRestricted {