[p4] Restrict creating jobs for general users

P4Shimada perforce-user-forum at forums.perforce.com
Wed May 27 11:20:02 PDT 2015


Posted on behalf of forum user 'P4Shimada'.

Hi Alexander,

You are welcome. If you do not want to use form triggers, you could block
commands from certain users or groups using the p4broker or pre-command triggers
instead.

Another way is to block users from running certain commands using pre-command
triggers. For example, here is one for user 'bruno' so the user can not
run job or jobs. Make it "job$" for just the job command:

no-jobs-bruno command pre-user-job "bash -c %quote%if [
'%user%' == 'bruno' ]; then echo %user% cannot run
%command%; exit 1; fi %quote%"  
EXAMPLE:

$ p4 -u bruno job 'no-jobs-bruno' validation failed: bruno cannot
run user-job  
An in-line bash script to do the test and deny the command, can be used. You can
base this on group membership too, for example:

"bash -c %quote%echo %groups% | grep limited > /dev/null; out=$?;
if [$out = 0 ]; then echo User %user% cannot run %command%.; exit
1; fi %quote%"  
Hope this helps some.



--
Please click here to see the post in its original format:
  http://forums.perforce.com/index.php?/topic/4109-restrict-creating-jobs-for-general-users



More information about the perforce-user mailing list