#!/usr/bin/perl #------------------------------------------------------------------------------ # Must Be Owner # # This broker filter script overrides P4D default behaviour, requiring that # the user running the specified command to edit/view a spec must be the # owner of the given spec, or else their command is rejected. For example, # if you do 'p4 client' p4 'p4 client -o MyWS', you must own the indicated # workspace. Super users bypass this always. # # Enable in the broker config file like this example for various commands: # # command: ^branch|client|label|group$ # { # action = filter; # checkauth = true; # execute = /p4/common/hms/scripts/broker_must_be_owner.pl; # } use strict; my $User; my $Cmd; my $AccessLevel; my $UpdateTime; my $ClientSpecName; my $SpecName; my $SpecOwner; while () { if (/^user: /) { $User = $_; chomp $User; $User =~ s/^user: //; } if (/^command: /) { $Cmd = $_; chomp $Cmd; $Cmd =~ s/^command: //; } if (/^workspace: /) { $ClientSpecName = $_; $ClientSpecName =~ s/^workspace: //; chomp $ClientSpecName; } # If we see certain flags that take an argument, like '-S ' or # '-t