<#
.SYNOPSIS
block_checkpoint.ps1 - Perforce trigger to block "p4 admin checkpoint"
.DESCRIPTION
Trigger table entry:
block-checkpoint command pre-user-admin "powershell -ExecutionPolicy Bypass -File /path/to/block_checkpoint.ps1 %user% %args%"
This trigger fires before any "p4 admin" command. The script checks
if the subcommand is "checkpoint" and blocks it.
#>
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$User,
[Parameter(Mandatory=$false, ValueFromRemainingArguments=$true)]
[string[]]$Args
)
$ArgsString = $Args -join ' '
if ($ArgsString -match 'checkpoint') {
Write-Output "Checkpoint blocked: User '$User' attempted to run 'p4 admin checkpoint'. This command is not permitted."
exit 1
}
# Allow all other "p4 admin" subcommands
exit 0