Skip to content

Commit

Permalink
disable edit submission on private
Browse files Browse the repository at this point in the history
  • Loading branch information
dchhabda committed Feb 23, 2023
1 parent 6bc39ea commit d8b35b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pybossa/forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ class ProjectUpdateForm(ProjectForm):
short_name = TextField(label=None, widget=HiddenInput())
long_description = TextAreaField(lazy_gettext('Long Description'))
allow_anonymous_contributors = BooleanField(lazy_gettext('Allow Anonymous Contributors'))
allow_taskrun_edit = BooleanField(lazy_gettext('Allow Editing of Task Submissions'))
private_instance = data_access.data_access_levels.get("valid_access_levels", []) == ["L1", "L2", "L3", "L4"]
if not private_instance:
allow_taskrun_edit = BooleanField(lazy_gettext('Allow Editing of Task Submissions'))
zip_download = BooleanField(lazy_gettext('Allow ZIP data download'))
category_id = SelectField(lazy_gettext('Category'), coerce=int)
hidden = BooleanField(lazy_gettext('Hide?'))
Expand Down
5 changes: 3 additions & 2 deletions pybossa/view/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,8 @@ def handle_valid_form(form):
'input_data': form.input_data_class.data,
'output_data': form.output_data_class.data
}
new_project.info["allow_taskrun_edit"] = form.allow_taskrun_edit.data
if "allow_taskrun_edit" in form:
new_project.info["allow_taskrun_edit"] = form.allow_taskrun_edit.data

project_repo.update(new_project)
auditlogger.add_log_entry(old_project, new_project, current_user)
Expand Down Expand Up @@ -854,7 +855,7 @@ def handle_valid_form(form):
project.kpi = project.info.get('kpi')
project.input_data_class = project.info.get('data_classification', {}).get('input_data')
project.output_data_class = project.info.get('data_classification', {}).get('output_data')
project.allow_taskrun_edit = project.info.get("allow_taskrun_edit")
project.allow_taskrun_edit = project.info.get("allow_taskrun_edit") or False
ensure_amp_config_applied_to_project(project, project.info.get('annotation_config', {}))
form = dynamic_project_form(ProjectUpdateForm, None, data_access_levels, obj=project,
products=prodsubprods, data_classes=data_classes)
Expand Down

0 comments on commit d8b35b5

Please sign in to comment.