Skip to content

Commit aa0d7d8

Browse files
committed
Ordered permsssions by least privilege flag
1 parent 3deb163 commit aa0d7d8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Authentication/Authentication/Models/GraphCommand.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,9 @@ public class GraphPermission
103103
/// Full deescription of the permission.
104104
/// </summary>
105105
public string FullDescription { get; set; }
106+
/// <summary>
107+
/// Least privilege flag shows whether the permission is the least privilege.
108+
/// </summary>
109+
public bool IsLeastPrivilege { get; set; }
106110
}
107111
}

tools/PostGeneration/NewCommandMetadata.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,15 @@ $ApiVersion | ForEach-Object {
102102
Description = $_.consentDisplayName
103103
FullDescription = $_.consentDescription
104104
IsAdmin = $_.IsAdmin
105+
ScopeType = $_.ScopeType
106+
IsLeastPrivilege = $_.isLeastPrivilege
105107
}
106108
}
107-
$MappingValue.Permissions = ($Permissions | Sort-Object -Property Name -Unique)
109+
$Permissions = $Permissions | Sort-Object -Property Name -Unique
110+
$Permissions = $Permissions | Sort-Object -Property ScopeType
111+
$Permissions = $Permissions | Sort-Object -Property IsLeastPrivilege
112+
[array]::Reverse($Permissions)
113+
$MappingValue.Permissions = $Permissions
108114
}
109115
catch {
110116
Write-Warning "Failed to fetch permissions: $($PermissionsUrl)?requesturl=$($MappingValue.Uri)&method=$($MappingValue.Method)"

0 commit comments

Comments
 (0)