6969 [Parameter (Mandatory , ParameterSetName = ' Path' )]
7070 [string []]$TargetPath ,
7171 [ValidateSet (' Admin' , ' Maintain' , ' Pull' , ' Push' , ' Triage' )]
72- [string []]$ValidPermissions = @ (' Admin' , ' Maintain' )
72+ [string []]$ValidPermissions = @ (' Admin' , ' Maintain' ),
73+ [string []]$AuthorizedAccounts
7374)
7475
7576begin {
@@ -101,6 +102,10 @@ begin {
101102 Console = Format-ConsoleStyle - Text $User - DefinedStyle UserName
102103 Markdown = " `` $User `` "
103104 }
105+ AuthorizedAccounts = @ {
106+ Console = Format-ConsoleStyle - Text ' AuthorizedAccounts' - DefinedStyle Success
107+ Markdown = ' `AuthorizedAccounts`'
108+ }
104109 }
105110 if (! [string ]::IsNullOrEmpty($TargetBranch )) {
106111 $ConsoleBranch = Format-ConsoleStyle - Text $TargetBranch - StyleComponent $TargetStyle
@@ -123,6 +128,19 @@ begin {
123128}
124129
125130process {
131+ if ($AuthorizedAccounts.Count -gt 0 -and $User -in $AuthorizedAccounts ) {
132+ $template = " Account {0} is explicitly permitted per the {1} parameter."
133+ $message = @ {
134+ summary = ($template -f $Texts.Author.Markdown , $Texts.AuthorizedAccounts.Markdown )
135+ console = ($template -f $Texts.Author.Console , $Texts.AuthorizedAccounts.Console )
136+ }
137+ $null = $Summary.AppendLine (' ## Authorization' ).AppendLine()
138+ $null = $Summary.AppendLine ($message.summary ).AppendLine()
139+ # Console Logging
140+ $message.console
141+
142+ return
143+ }
126144 try {
127145 $Permissions = Get-AuthorPermission - Owner $Owner - Repo $Repo - Author $User
128146 } catch {
@@ -149,7 +167,7 @@ process {
149167 " $Prefix `t $Setting "
150168 }
151169 # endregion Permission Retrieval Messaging
152-
170+
153171 $null = $Summary.AppendLine (' ## Result' ).AppendLine()
154172
155173 # Check for authorization; if the user has any of the valid permissions, they
0 commit comments