Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Move the unauthenticated_changed to the writable_attributes to make it work for the Project schema too.

Dombi Attilaf2db89e75fb2
diff --git a/app/contracts/projects/update_contract.rb b/app/contracts/projects/update_contract.rb
index 8c5e10a2b15..a777926e0d4 100644
--- a/app/contracts/projects/update_contract.rb
+++ b/app/contracts/projects/update_contract.rb
@@ -28,24 +28,27 @@
module Projects
class UpdateContract < BaseContract
- private
- def unauthenticated_changed
+ def writable_attributes
permissions = {
- edit_project_attributes: user.allowed_in_project?(:edit_project_attributes, model),
- edit_project: user.allowed_in_project?(:edit_project, model)
+ project_attributes_only: options[:project_attributes_only],
+ edit_project: user.allowed_in_project?(:edit_project, model),
+ edit_project_attributes: user.allowed_in_project?(:edit_project_attributes, model)
}
case permissions
- in { edit_project_attributes: true, edit_project: false }
- super + without_custom_fields(changed_by_user)
- in { edit_project_attributes: false, edit_project: true }
- super + with_custom_fields_only(changed_by_user)
+ in { project_attributes_only: true } |
+ { edit_project: false, edit_project_attributes: true }
+ with_custom_fields_only(super)
+ in { edit_project: true, edit_project_attributes: false }
+ without_custom_fields(super)
else
super
end
end
+ private
+
def without_custom_fields(changes)
changes.grep_v(/^custom_field_/)
end