Skip to content

Commit

Permalink
skip collections for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjholm committed Nov 13, 2023
1 parent 4d2a9be commit 64ac9e8
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions cloud/azure/deploy/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,27 @@ func NewAzureADPolicy(ctx *pulumi.Context, name string, args *PolicyArgs, opts .
return nil, err
}

for _, principal := range args.Policy.Principals {
// The roles we need to assign
roles := actionsToAzureRoleDefinitions(args.Roles.RoleDefinitions, args.Policy.Actions)
if len(roles) == 0 {
return nil, fmt.Errorf("policy contained not assignable actions %+v, %+v", args.Policy, args.Roles.RoleDefinitions)
for _, resource := range args.Policy.Resources {
if resource.Type == v1.ResourceType_Collection {
continue
}

sp, ok := args.Principals[principal.Type][principal.Name]
if !ok {
return nil, fmt.Errorf("principal %s of type %s not found", principal.Name, principal.Type)
}
for _, principal := range args.Policy.Principals {
// The roles we need to assign
roles := actionsToAzureRoleDefinitions(args.Roles.RoleDefinitions, args.Policy.Actions)
if len(roles) == 0 {
return nil, fmt.Errorf("policy contained not assignable actions %+v, %+v", args.Policy, args.Roles.RoleDefinitions)
}

// We have the principal and the roles we need to assign
// just need to scope the resource type to the RoleAssignments
for roleName, role := range roles {
for _, resource := range args.Policy.Resources {
// FIXME: Implement collection and secret least priveledge
if resource.Type == v1.ResourceType_Collection {
continue
}
sp, ok := args.Principals[principal.Type][principal.Name]
if !ok {
return nil, fmt.Errorf("principal %s of type %s not found", principal.Name, principal.Type)
}

// We have the principal and the roles we need to assign
// just need to scope the resource type to the RoleAssignments
for roleName, role := range roles {
// FIXME: Implement collection and secret least priveledge
scope, err := scopeFromResource(resource, args.Resources, args.ResourceGroupName)
if err != nil {
return nil, err
Expand Down

0 comments on commit 64ac9e8

Please sign in to comment.