Skip to content

Commit

Permalink
Merge pull request #21 from ConductorOne/mstanbCO/panic_fix
Browse files Browse the repository at this point in the history
Fix panic with principal resource being nil
  • Loading branch information
mstanbCO authored Apr 11, 2024
2 parents 4677579 + 28e852d commit b3af4af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/connector/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ func (o *workspaceRoleType) Revoke(ctx context.Context, grant *v2.Grant) (annota
return nil, fmt.Errorf("baton-slack: only users can have role revoked")
}

if principal.ParentResourceId == nil {
l.Warn(
"baton-slack: user does not have a parent resource",
zap.String("principal_id", principal.Id.Resource),
)
return nil, fmt.Errorf("baton-slack: user does not have a parent resource")
}

// empty role type means regular user
err := o.enterpriseClient.SetWorkspaceRole(ctx, principal.ParentResourceId.Resource, principal.Id.Resource, "")

Expand Down

0 comments on commit b3af4af

Please sign in to comment.