@@ -130,7 +130,7 @@ public PSRoleAssignment CreateRoleAssignment(FilterRoleAssignmentsOptions parame
130
130
/// </summary>
131
131
/// <param name="options">The filtering options</param>
132
132
/// <returns>The filtered role assignments</returns>
133
- public List < PSRoleAssignment > FilterRoleAssignments ( FilterRoleAssignmentsOptions options , bool excludeAssignmentsForDeletedPrincipals = true )
133
+ public List < PSRoleAssignment > FilterRoleAssignments ( FilterRoleAssignmentsOptions options )
134
134
{
135
135
List < PSRoleAssignment > result = new List < PSRoleAssignment > ( ) ;
136
136
ListAssignmentsFilterParameters parameters = new ListAssignmentsFilterParameters ( ) ;
@@ -140,25 +140,25 @@ public List<PSRoleAssignment> FilterRoleAssignments(FilterRoleAssignmentsOptions
140
140
// Filter first by principal
141
141
parameters . PrincipalId = string . IsNullOrEmpty ( options . ADObjectFilter . Id ) ? ActiveDirectoryClient . GetObjectId ( options . ADObjectFilter ) : Guid . Parse ( options . ADObjectFilter . Id ) ;
142
142
result . AddRange ( AuthorizationManagementClient . RoleAssignments . List ( parameters )
143
- . RoleAssignments . Select ( r => r . ToPSRoleAssignment ( this , ActiveDirectoryClient , excludeAssignmentsForDeletedPrincipals ) ) . Where ( r => r != null ) ) ;
143
+ . RoleAssignments . Select ( r => r . ToPSRoleAssignment ( this , ActiveDirectoryClient , options . ExcludeAssignmentsForDeletedPrincipals ) ) . Where ( r => r != null ) ) ;
144
144
145
145
// Filter out by scope
146
146
if ( ! string . IsNullOrEmpty ( options . Scope ) )
147
147
{
148
- result . RemoveAll ( r => ! options . Scope . StartsWith ( r . Scope , StringComparison . InvariantCultureIgnoreCase ) ) ;
148
+ result . RemoveAll ( r => ! options . Scope . StartsWith ( r . Scope , StringComparison . InvariantCultureIgnoreCase ) ) ;
149
149
}
150
150
}
151
151
else if ( ! string . IsNullOrEmpty ( options . Scope ) )
152
152
{
153
153
// Filter by scope and above directly
154
154
parameters . AtScope = true ;
155
155
result . AddRange ( AuthorizationManagementClient . RoleAssignments . ListForScope ( options . Scope , parameters )
156
- . RoleAssignments . Select ( r => r . ToPSRoleAssignment ( this , ActiveDirectoryClient , excludeAssignmentsForDeletedPrincipals ) ) . Where ( r => r != null ) ) ;
156
+ . RoleAssignments . Select ( r => r . ToPSRoleAssignment ( this , ActiveDirectoryClient , options . ExcludeAssignmentsForDeletedPrincipals ) ) . Where ( r => r != null ) ) ;
157
157
}
158
158
else
159
159
{
160
160
result . AddRange ( AuthorizationManagementClient . RoleAssignments . List ( parameters )
161
- . RoleAssignments . Select ( r => r . ToPSRoleAssignment ( this , ActiveDirectoryClient , excludeAssignmentsForDeletedPrincipals ) ) . Where ( r => r != null ) ) ;
161
+ . RoleAssignments . Select ( r => r . ToPSRoleAssignment ( this , ActiveDirectoryClient , options . ExcludeAssignmentsForDeletedPrincipals ) ) . Where ( r => r != null ) ) ;
162
162
}
163
163
164
164
if ( ! string . IsNullOrEmpty ( options . RoleDefinition ) )
@@ -177,7 +177,7 @@ public List<PSRoleAssignment> FilterRoleAssignments(FilterRoleAssignmentsOptions
177
177
public PSRoleAssignment RemoveRoleAssignment ( FilterRoleAssignmentsOptions options )
178
178
{
179
179
// Match role assignments at exact scope. At most 1 roleAssignment should match the criteria
180
- PSRoleAssignment roleAssignment = FilterRoleAssignments ( options , excludeAssignmentsForDeletedPrincipals : false )
180
+ PSRoleAssignment roleAssignment = FilterRoleAssignments ( options )
181
181
. Where ( ra => ra . Scope == options . Scope . TrimEnd ( '/' ) )
182
182
. FirstOrDefault ( ) ;
183
183
0 commit comments