Beam::Runnable::AllowUsers - Only allow certain users to run a command
version 0.012
### In a Runnable module package My::Runnable::Script; use Moo; with 'Beam::Runnable', 'Beam::Runnable::AllowUsers'; has '+allow_users' => ( default => [ 'root' ] ); sub run { } ### In a container config file runnable: $class: My::Runnable::Script $with: - 'Beam::Runnable::AllowUsers' allow_users: - root - doug
This role checks to ensure that only certain users can run a command. If an unauthorized user runs the command, it dies with an error instead.
NOTE: This is mostly a demonstration of a Beam::Runnable role. Users that can write to the configuration file can edit who is allowed to run the command, and there are other ways to prevent access to a file/command.
An array reference of user names that are allowed to run this task.
This role wraps the run method of your runnable class to check that the user is authorized.
run
Beam::Runnable, "getpwuid" in perlfunc, "$>" in perlvar
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Beam::Runner, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beam::Runner
CPAN shell
perl -MCPAN -e shell install Beam::Runner
For more information on module installation, please visit the detailed CPAN module installation guide.