Add privilegedExecution flag to database and Poseidon Strategy
This commit is contained in:

committed by
Sebastian Serth

parent
dffeca27de
commit
eb188dcd71
@ -113,9 +113,10 @@ class ExecutionEnvironmentsController < ApplicationController
|
||||
[]
|
||||
end
|
||||
|
||||
params[:execution_environment].permit(:docker_image, :editor_mode, :file_extension, :file_type_id, :help, :indent_size, :memory_limit, :cpu_limit, :name, :network_enabled, :permitted_execution_time, :pool_size, :run_command, :test_command, :testing_framework).merge(
|
||||
user_id: current_user.id, user_type: current_user.class.name, exposed_ports: exposed_ports
|
||||
)
|
||||
params[:execution_environment]
|
||||
.permit(:docker_image, :editor_mode, :file_extension, :file_type_id, :help, :indent_size, :memory_limit, :cpu_limit, :name,
|
||||
:network_enabled, :privileged_execution, :permitted_execution_time, :pool_size, :run_command, :test_command, :testing_framework)
|
||||
.merge(user_id: current_user.id, user_type: current_user.class.name, exposed_ports: exposed_ports)
|
||||
end
|
||||
end
|
||||
private :execution_environment_params
|
||||
|
@ -27,6 +27,7 @@ class ExecutionEnvironment < ApplicationRecord
|
||||
validates :memory_limit,
|
||||
numericality: {greater_than_or_equal_to: MINIMUM_MEMORY_LIMIT, only_integer: true}, presence: true
|
||||
validates :network_enabled, boolean_presence: true
|
||||
validates :privileged_execution, boolean_presence: true
|
||||
validates :name, presence: true
|
||||
validates :permitted_execution_time, numericality: {only_integer: true}, presence: true
|
||||
validates :pool_size, numericality: {only_integer: true}, presence: true
|
||||
|
@ -28,6 +28,10 @@
|
||||
label.form-check-label
|
||||
= f.check_box(:network_enabled, class: 'form-check-input')
|
||||
= t('activerecord.attributes.execution_environment.network_enabled')
|
||||
.form-check.mb-3
|
||||
label.form-check-label
|
||||
= f.check_box(:privileged_execution, class: 'form-check-input')
|
||||
= t('activerecord.attributes.execution_environment.privileged_execution')
|
||||
.mb-3
|
||||
= f.label(:permitted_execution_time, class: 'form-label')
|
||||
= f.number_field(:permitted_execution_time, class: 'form-control', min: 1)
|
||||
|
@ -15,6 +15,7 @@ h1.d-inline-block = ExecutionEnvironment.model_name.human(count: 2)
|
||||
th = t('activerecord.attributes.execution_environment.memory_limit')
|
||||
th = t('activerecord.attributes.execution_environment.cpu_limit')
|
||||
th = t('activerecord.attributes.execution_environment.network_enabled')
|
||||
th = t('activerecord.attributes.execution_environment.privileged_execution')
|
||||
th = t('activerecord.attributes.execution_environment.permitted_execution_time')
|
||||
th colspan=5 = t('shared.actions')
|
||||
tbody
|
||||
@ -26,6 +27,7 @@ h1.d-inline-block = ExecutionEnvironment.model_name.human(count: 2)
|
||||
td = execution_environment.memory_limit
|
||||
td = execution_environment.cpu_limit
|
||||
td = symbol_for(execution_environment.network_enabled)
|
||||
td = symbol_for(execution_environment.privileged_execution)
|
||||
td = execution_environment.permitted_execution_time
|
||||
td = link_to(t('shared.show'), execution_environment) if policy(execution_environment).show?
|
||||
td = link_to(t('shared.edit'), edit_execution_environment_path(execution_environment)) if policy(execution_environment).edit?
|
||||
|
@ -11,7 +11,7 @@ h1.d-inline-block = @execution_environment
|
||||
= row(label: 'execution_environment.name', value: @execution_environment.name)
|
||||
= row(label: 'execution_environment.user', value: link_to_if(policy(@execution_environment.author).show?, @execution_environment.author, @execution_environment.author))
|
||||
= row(label: 'execution_environment.file_type', value: @execution_environment.file_type.present? ? link_to(@execution_environment.file_type, @execution_environment.file_type) : nil)
|
||||
- [:docker_image, :exposed_ports_list, :memory_limit, :cpu_limit, :network_enabled, :permitted_execution_time, :pool_size].each do |attribute|
|
||||
- [:docker_image, :exposed_ports_list, :memory_limit, :cpu_limit, :network_enabled, :privileged_execution, :permitted_execution_time, :pool_size].each do |attribute|
|
||||
= row(label: "execution_environment.#{attribute}", value: @execution_environment.send(attribute))
|
||||
- [:run_command, :test_command].each do |attribute|
|
||||
= row(label: "execution_environment.#{attribute}") do
|
||||
|
Reference in New Issue
Block a user