Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions plugins/python/example_policy_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ def check_policy(self, argv: tuple, env_add: tuple):
cmd = argv[0]
# Example for a simple reject:
if not self._is_command_allowed(cmd):
sudo.log_error("You are not allowed to run this command!")
return sudo.RC.REJECT

raise sudo.PluginError("You are not allowed to run this command!")
error_msg = "You are not allowed to run this command!"
sudo.log_error(error_msg)
raise sudo.PluginReject(error_msg)

# The environment the command will be executed with (we allow any here)
user_env_out = sudo.options_from_dict(self.user_env) + env_add
Expand Down
Loading