#!/usr/bin/env python #============================================================================== # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE #------------------------------------------------------------------------------ # # This is command trigger to allow you to block commands from all but listed users. # # Trigger table entry examples: # command-block command pre-user-obliterate "/p4/common/bin/triggers/command_block.py %user%" # command-block command pre-user-(obliterate|protect$) "/p4/common/bin/triggers/command_block.py %user%" import sys passusers = [ 'perforce' ] user=sys.argv[1] if user in passusers: sys.exit(0) else: print("You are not allowed to run this command.") sys.exit(1)
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 27331 | C. Thomas Tyler |
Released SDP 2020.1.27325 (2021/01/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
//guest/perforce_software/sdp/dev/Unsupported/Samples/triggers/command_block.py | |||||
#1 | 26652 | Robert Cowham |
This is Tom's change: Introduced new 'Unsupported' directory to clarify that some files in the SDP are not officially supported. These files are samples for illustration, to provide examples, or are deprecated but not yet ready for removal from the package. The Maintenance and many SDP triggers have been moved under here, along with other SDP scripts and triggers. Added comments to p4_vars indicating that it should not be edited directly. Added reference to an optional site_global_vars file that, if it exists, will be sourced to provide global user settings without needing to edit p4_vars. As an exception to the refactoring, the totalusers.py Maintenance script will be moved to indicate that it is supported. Removed settings to support long-sunset P4Web from supported structure. Structure under new .../Unsupported folder is: Samples/bin Sample scripts. Samples/triggers Sample trigger scripts. Samples/triggers/tests Sample trigger script tests. Samples/broker Sample broker filter scripts. Deprecated/triggers Deprecated triggers. To Do in a subsequent change: Make corresponding doc changes. |
||
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/triggers/command_block.py | |||||
#4 | 22318 | Russell C. Jackson (Rusty) | Corrected comments for trigger file name. | ||
#3 | 16373 | C. Thomas Tyler |
Routine Merge Down to dev from main using: p4 merge -b perforce_software-sdp-dev |
||
#2 | 16029 | C. Thomas Tyler |
Routine merge to dev from main using: p4 merge -b perforce_software-sdp-dev |
||
#1 | 12107 | C. Thomas Tyler |
Routine merge down from 'main' to 'dev', resolved with 'p4 resolve -as'. |
||
//guest/perforce_software/sdp/main/Server/Unix/p4/common/bin/triggers/command_block.py | |||||
#2 | 12104 | Russell C. Jackson (Rusty) | Updated date to 2015 | ||
#1 | 12067 | Russell C. Jackson (Rusty) |
Changed mkdirs.sh to default to 1666 and added comment to replace the broker with command triggers. Added simple command trigger to block commands in the server. |