Skip to content

Commit

Permalink
Merge pull request #14 from ConductorOne/mstanbCO/add_member_role
Browse files Browse the repository at this point in the history
Adds support for syncing member roles
  • Loading branch information
mstanbCO authored Mar 11, 2024
2 parents 19c69c8 + 6242458 commit 5025011
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/connector/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
SingleChannelGuestRoleID = "single_channel_guest"
InvitedMemberRoleID = "invited_member"
BotRoleID = "bot"
MemberRoleID = "member"

RoleAssignmentEntitlement = "assigned"
)
Expand All @@ -32,6 +33,7 @@ var roles = map[string]string{
SingleChannelGuestRoleID: "Single Channel Guest",
InvitedMemberRoleID: "Invited member",
BotRoleID: "Bot",
MemberRoleID: "Member",
}

type workspaceRoleType struct {
Expand Down
8 changes: 8 additions & 0 deletions pkg/connector/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ 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)
Expand Down

0 comments on commit 5025011

Please sign in to comment.