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

Update project attributes permissions to use edit_project_attributes

Dombi Attila76d33836cbfe
diff --git a/app/contracts/projects/update_contract.rb b/app/contracts/projects/update_contract.rb
index 471a55e86fb..3468f50b547 100644
--- a/app/contracts/projects/update_contract.rb
+++ b/app/contracts/projects/update_contract.rb
@@ -33,6 +33,8 @@ module Projects
def manage_permission
if changed_by_user == ["active"]
:archive_project
+ elsif changed_by_user.all? { |c| c.match(/^custom_field_/) }
+ :edit_project_attributes
else
# if "active" is changed, :archive_project permission will also be
# checked in `Projects::BaseContract#validate_changing_active`
diff --git a/modules/overviews/app/components/project_custom_fields/sections/show_component.rb b/modules/overviews/app/components/project_custom_fields/sections/show_component.rb
index bce4f3bf995..f1db2b06a41 100644
--- a/modules/overviews/app/components/project_custom_fields/sections/show_component.rb
+++ b/modules/overviews/app/components/project_custom_fields/sections/show_component.rb
@@ -46,7 +46,7 @@ module ProjectCustomFields
private
def allowed_to_edit?
- User.current.allowed_in_project?(:edit_project, @project)
+ User.current.allowed_in_project?(:edit_project_attributes, @project)
end
def eager_load_project_custom_field_values