Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the admin to indicate that task can modify its input in a ToolConfig #1054

Closed
prioux opened this issue Nov 16, 2020 · 3 comments · Fixed by #1059
Closed

Allow the admin to indicate that task can modify its input in a ToolConfig #1054

prioux opened this issue Nov 16, 2020 · 3 comments · Fixed by #1059

Comments

@prioux
Copy link
Member

prioux commented Nov 16, 2020

Right now the CBRAIN task launching interface will refuse to launch a task when:

  1. the user has selected a file that they don't own
  2. the file's group_writable attribute is set to read-only
  3. the task doesn't say explicitly that it doesn't modify its inputs

The behavior of point 3 is the default. A task can inform the framework that it doesn't modify its inputs by having either:

  • task_properties :readonly_input_files in portal/taskname.rb (standard integration)
  • "custom": { "cbrain:readonly-input-files": true } (Boutiques integration)

Given that often integrators forget to set these properties, the admin should have the ability to override the behavior directly in a ToolConfig (or maybe directly at the Tool level?). This would be provided by a simply checkbox in the ToolConfig form, associated with a new boolean attribute:

  [ ] Does not require write-access to inputs
@prioux
Copy link
Member Author

prioux commented Nov 16, 2020

The code that makes the check is in the tasks_controller.rb

    # Filter list of files as provided by the get request
    file_ids = params[:file_ids] || []
    access   = @task.class.properties[:readonly_input_files] ? :read : :write
    @files   = Userfile.find_accessible_by_user(file_ids, current_user, :access_requested => access) rescue []
    if @files.empty?
      flash[:error] = "You must select at least one file to which you have write access."
      redirect_to :controller  => :userfiles, :action  => :index
      return
    end

@prioux
Copy link
Member Author

prioux commented Nov 16, 2020

If the checkbox is not set in the tool config (which should be default), then the value of the task integration code is used, as normal, which can mean yes or no.
If the checkbox is set, the value of the task's integration is ignored and the task is considered to not modify its inputs (meaning the find_accessible_by_user() with use :read )

@prioux
Copy link
Member Author

prioux commented Nov 16, 2020

Make sure the migration sets a default value to 'false' in the table.

MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Nov 23, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Nov 23, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Nov 23, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Nov 23, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Nov 23, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Nov 23, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Nov 23, 2020
@MontrealSergiy MontrealSergiy linked a pull request Nov 23, 2020 that will close this issue
@MontrealSergiy MontrealSergiy changed the title Allow the admin to indicate if a task modifies its input in a ToolConfig Allow the admin to indicate that task can modify its input in a ToolConfig Dec 1, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Dec 1, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Dec 1, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Dec 8, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Dec 15, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Dec 15, 2020
MontrealSergiy added a commit to MontrealSergiy/cbrain that referenced this issue Dec 15, 2020
prioux added a commit that referenced this issue Dec 15, 2020
Tool config data immutability flag resolves #1054
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants