Skip to content

Commit

Permalink
Fix lightdash_space (#157)
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Ishikawa <[email protected]>
  • Loading branch information
yu-iskw authored Jul 23, 2024
1 parent eab3196 commit a67cec5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/provider/resource_lightdash_space.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,15 @@ func (r *spaceResource) Update(ctx context.Context, req resource.UpdateRequest,
// Grant access to new users
var updatedAccessList []spaceResourceAccessBlockModel
for _, access := range plan.AccessList {
// Skip if the user doesn't exist in the organization
_, err := organizationMembersService.GetOrganizationMemberByUserUuid(access.UserUUID.ValueString())
if err != nil {
resp.Diagnostics.AddWarning(
"User no longer exists in the organization",
fmt.Sprintf("User %s no longer exists in the organization. Skipping granting access to the space.", access.UserUUID),
)
continue
}
// Check if the user is an organization admin
// It is not possible to revoke space access from organization admins
isOrganizationAdmin, err := organizationMembersService.IsOrganizationAdmin(access.UserUUID.ValueString())
Expand Down

0 comments on commit a67cec5

Please sign in to comment.