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

adapt permission for wp custom field visibility check

ulferts67f3b2533c26
diff --git a/app/models/work_package_custom_field.rb b/app/models/work_package_custom_field.rb
index 6cebb078611..dae6593ec45 100644
--- a/app/models/work_package_custom_field.rb
+++ b/app/models/work_package_custom_field.rb
@@ -39,7 +39,7 @@ class WorkPackageCustomField < CustomField
through: :work_package_custom_values
scope :visible_by_user, ->(user) {
- if user.allowed_to_globally?(:edit_projects)
+ if user.allowed_to_globally?(:select_custom_fields)
all
else
where(projects: { id: Project.visible(user) })
diff --git a/spec/models/attribute_help_text/work_package_spec.rb b/spec/models/attribute_help_text/work_package_spec.rb
index 8a193b330b8..4602a1ef321 100644
--- a/spec/models/attribute_help_text/work_package_spec.rb
+++ b/spec/models/attribute_help_text/work_package_spec.rb
@@ -96,8 +96,8 @@ describe AttributeHelpText::WorkPackage, type: :model do
end
end
- context 'user having the `edit_projects` permission' do
- let(:permissions) { [:edit_projects] }
+ context 'user having the `select_custom_fields` permission' do
+ let(:permissions) { [:select_custom_fields] }
it 'returns the help text for the static and cf attribute' do
is_expected