Shell: Add toggle to execute command as root

This commit is contained in:
Sebastian Serth
2022-10-04 14:42:15 +02:00
parent f22e3b56f1
commit f53c6cb3ee
8 changed files with 26 additions and 15 deletions

View File

@ -29,7 +29,8 @@ class ExecutionEnvironmentsController < ApplicationController
def execute_command
runner = Runner.for(current_user, @execution_environment)
output = runner.execute_command(params[:command], raise_exception: false)
sudo = ActiveModel::Type::Boolean.new.cast(params[:sudo])
output = runner.execute_command(params[:command], privileged_execution: sudo, raise_exception: false)
render json: output.except(:messages)
end