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

add new permissions for comments with restricted visibility

Bruno Pagno7b47777aea18
diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rb
index ec148071682..aba60b7c17a 100644
--- a/config/initializers/permissions.rb
+++ b/config/initializers/permissions.rb
@@ -309,6 +309,30 @@ Rails.application.reloader.to_prepare do
require: :loggedin,
dependencies: :view_work_packages
+ wpt.permission :view_comments_with_restricted_visibility,
+ {},
+ permissible_on: %i[work_package project],
+ require: :loggedin,
+ dependencies: :view_work_packages
+
+ wpt.permission :write_comments_with_restricted_visibility,
+ {},
+ permissible_on: %i[work_package project],
+ require: :loggedin,
+ dependencies: :view_work_packages
+
+ wpt.permission :edit_own_comments_with_restricted_visibility,
+ {},
+ permissible_on: %i[work_package project],
+ require: :loggedin,
+ dependencies: :view_work_packages
+
+ wpt.permission :edit_others_comments_with_restricted_visibility,
+ {},
+ permissible_on: %i[work_package project],
+ require: :loggedin,
+ dependencies: :view_work_packages
+
# WP attachments can be added with :edit_work_packages, this permission allows it without Edit WP as well.
wpt.permission :add_work_package_attachments,
{},
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 61826319d7f..ab70803566b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3358,9 +3358,12 @@ en:
permission_edit_work_package_notes_explanation: "Caution: Users with this permission are able to edit anyone's comment."
permission_edit_work_packages: "Edit work packages"
permission_edit_messages: "Edit messages"
+ permission_edit_own_comments_with_restricted_visibility: "Edit own comments with restricted visibility"
permission_edit_own_work_package_notes: "Edit own comments"
permission_edit_own_messages: "Edit own messages"
permission_edit_own_time_entries: "Edit own time logs"
+ permission_edit_others_comments_with_restricted_visibility: "Moderate comments with restricted visibility"
+ permission_edit_others_comments_with_restricted_visibility_explanation: "Caution: Users with this permission are able to edit other users' comments with restricted visibility."
permission_edit_project: "Edit project"
permission_edit_project_attributes: "Edit project attributes"
permission_edit_project_stages_and_gates: "Edit project stages and gates"
@@ -3401,6 +3404,7 @@ en:
permission_manage_own_reminders: "Create own reminders"
permission_view_project: "View projects"
permission_view_changesets: "View repository revisions in OpenProject"
+ permission_view_comments_with_restricted_visibility: "View comments with restricted visibility"
permission_view_commit_author_statistics: "View commit author statistics"
permission_view_dashboards: "View dashboards"
permission_view_work_package_watchers: "View watchers list"
@@ -3417,6 +3421,7 @@ en:
permission_view_wiki_pages: "View wiki"
permission_work_package_assigned: "Become assignee/responsible"
permission_work_package_assigned_explanation: "Work packages can be assigned to users and groups in possession of this role in the respective project"
+ permission_write_comments_with_restricted_visibility: "Write comments with restricted visibility"
permission_view_project_activity: "View project activity"
permission_view_project_attributes: "View project attributes"
permission_view_project_stages_and_gates: "View project stages and gates"
diff --git a/db/migrate/20250227161653_populate_comments_with_restricted_visibility_permissions.rb b/db/migrate/20250227161653_populate_comments_with_restricted_visibility_permissions.rb
index 778315a094c..456a076ade9 100644
--- a/db/migrate/20250227161653_populate_comments_with_restricted_visibility_permissions.rb
+++ b/db/migrate/20250227161653_populate_comments_with_restricted_visibility_permissions.rb
@@ -33,13 +33,10 @@ require Rails.root.join("db/migrate/migration_utils/permission_adder")
class PopulateCommentsWithRestrictedVisibilityPermissions < ActiveRecord::Migration[7.1]
def up
# grant the permission to view/write/edit comments with restricted visibility
- # to users that can manage work package relations
- ::Migration::MigrationUtils::PermissionAdder.add(:manage_work_package_relations,
- :view_comments_with_restricted_visibility)
- ::Migration::MigrationUtils::PermissionAdder.add(:manage_work_package_relations,
- :write_comments_with_restricted_visibility)
- ::Migration::MigrationUtils::PermissionAdder.add(:manage_work_package_relations,
- :edit_own_comments_with_restricted_visibility)
+ # to users that can manage project members
+ ::Migration::MigrationUtils::PermissionAdder.add(:manage_members, :view_comments_with_restricted_visibility)
+ ::Migration::MigrationUtils::PermissionAdder.add(:manage_members, :write_comments_with_restricted_visibility)
+ ::Migration::MigrationUtils::PermissionAdder.add(:manage_members, :edit_own_comments_with_restricted_visibility)
end
# noop