Skip to content

Commit

Permalink
Add type safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
otterobert committed Dec 15, 2024
1 parent 85d8fde commit 8adac55
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/shared/azureagent/customroles.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ func (a *Agent) CreateCustomRole(ctx context.Context, scope string, uai armmsi.I
}

func (a *Agent) UpdateCustomRole(ctx context.Context, scope string, role *armauthorization.RoleDefinition, actions []v2alpha1.AzureAction, dataActions []v2alpha1.AzureDataAction) error {
if role == nil || role.Properties == nil || role.Properties.Permissions == nil || len(role.Properties.Permissions) == 0 {
return errors.Errorf("role definition is nil or does not have any permissions")
}

roleScope := a.getSubscriptionScope(scope)

formattedActions := lo.Map(actions, func(action v2alpha1.AzureAction, _ int) *string {
Expand Down

0 comments on commit 8adac55

Please sign in to comment.