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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Replace allowed_to checks in views
Klaus Zanders4536ffddc54c
diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erbindex 161bdfb7676..76ae6e7b1e9 100644--- a/app/views/forums/index.html.erb+++ b/app/views/forums/index.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><% html_title t(:label_forum_plural) %><%= toolbar title: t(:label_forum_plural) do %>- <% if User.current.allowed_to?(:manage_forums, @project) %>+ <% if User.current.allowed_in_project?(:manage_forums, @project) %><li class="toolbar-item"><%= link_to(new_project_forum_path(@project),{ aria: { label: t(:label_forum_new) },@@ -52,7 +52,7 @@ See COPYRIGHT and LICENSE files for more details.<col opHighlightCol><col opHighlightCol><col opHighlightCol>- <% if User.current.allowed_to?(:manage_forums, @project) %>+ <% if User.current.allowed_in_project?(:manage_forums, @project) %><col opHighlightCol><col><% end %>@@ -95,7 +95,7 @@ See COPYRIGHT and LICENSE files for more details.</div></div></th>- <% if User.current.allowed_to?(:manage_forums, @project) %>+ <% if User.current.allowed_in_project?(:manage_forums, @project) %><th><div class="generic-table--sort-header-outer"><div class="generic-table--sort-header">@@ -125,7 +125,7 @@ See COPYRIGHT and LICENSE files for more details.<%= link_to_message forum.last_message, no_root: true %><% end %></td>- <% if User.current.allowed_to?(:manage_forums, @project) %>+ <% if User.current.allowed_in_project?(:manage_forums, @project) %><td class="small-icons"><% if authorize_for 'forums', 'edit' %><%= reorder_links 'forum', controller: '/forums',diff --git a/app/views/individual_principals/_memberships.html.erb b/app/views/individual_principals/_memberships.html.erbindex f4a62486b7a..461457c4279 100644--- a/app/views/individual_principals/_memberships.html.erb+++ b/app/views/individual_principals/_memberships.html.erb@@ -116,7 +116,7 @@ See COPYRIGHT and LICENSE files for more details.roles: roles,projects: projects) %><td class="buttons">- <% if User.current.allowed_to?(:manage_members, membership.project) %>+ <% if User.current.allowed_in_project?(:manage_members, membership.project) %><%= link_to_function icon_wrapper('icon icon-edit', t(:button_edit)),"jQuery('.member-#{membership.id}--edit-toggle-item').toggle();",class: "member-#{membership.id}--edit-toggle-item memberships--edit-button",diff --git a/app/views/messages/_form.html.erb b/app/views/messages/_form.html.erbindex 6c1b3d682a0..f3db82d7d47 100644--- a/app/views/messages/_form.html.erb+++ b/app/views/messages/_form.html.erb@@ -47,7 +47,7 @@ See COPYRIGHT and LICENSE files for more details.<%= f.check_box :locked, label: I18n.t('js.label_board_locked') %></div><% end %>-<% if !replying && [email protected]_record? && User.current.allowed_to?(:edit_messages, @project) %>+<% if !replying && [email protected]_record? && User.current.allowed_in_project?(:edit_messages, @project) %><div class="form--field"><%= f.select :forum_id, @project.forums.collect {|b| [b.name, b.id]}, label: Forum.model_name.human, container_class: '-wide' %></div>diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erbindex e9fd1a4779e..fc2fab0c29f 100644--- a/app/views/news/index.html.erb+++ b/app/views/news/index.html.erb@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%- managable = User.current.allowed_to?(:manage_news, @project)+ managable = User.current.allowed_in_project?(:manage_news, @project)%><% html_title(t(:label_news_plural)) -%>diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erbindex 83f6058f4cc..f27544ceef7 100644--- a/app/views/news/show.html.erb+++ b/app/views/news/show.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%= toolbar title: "#{avatar(@news.author)} #{h @news.title}".html_safe do %>- <% if User.current.allowed_to?(:manage_news, @project) %>+ <% if User.current.allowed_in_project?(:manage_news, @project) %><li class="toolbar-item"><%= link_to(edit_news_path(@news),accesskey: accesskey(:edit),@@ -42,7 +42,7 @@ See COPYRIGHT and LICENSE files for more details.<li class="toolbar-item"><%= watcher_link(@news, User.current) %></li>- <% if User.current.allowed_to?(:manage_news, @project) %>+ <% if User.current.allowed_in_project?(:manage_news, @project) %><li class="toolbar-item"><%= link_to(news_path(@news),data: { confirm: t(:text_are_you_sure) },diff --git a/app/views/projects/_toolbar.html.erb b/app/views/projects/_toolbar.html.erbindex 25e3c0dd769..b24feb364fa 100644--- a/app/views/projects/_toolbar.html.erb+++ b/app/views/projects/_toolbar.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%= toolbar title: t(:label_information_plural) do %>- <% if User.current.allowed_to?(:add_subprojects, @project) %>+ <% if User.current.allowed_in_project?(:add_subprojects, @project) %><li class="toolbar-item"><%= link_to new_project_path(parent_id: @project.id),{ class: 'button -alt-highlight',@@ -53,7 +53,7 @@ See COPYRIGHT and LICENSE files for more details.<% end %></li><% end %>- <% if User.current.allowed_to?(:archive_project, @project) %>+ <% if User.current.allowed_in_project?(:archive_project, @project) %><li class="toolbar-item hidden-for-tablet"><%= link_to(project_archive_path(@project, status: '', name: @project.name),data: { confirm: t('project.archive.are_you_sure', name: @project.name) },diff --git a/app/views/projects/settings/categories/show.html.erb b/app/views/projects/settings/categories/show.html.erbindex 70fce00e552..e68b13f3649 100644--- a/app/views/projects/settings/categories/show.html.erb+++ b/app/views/projects/settings/categories/show.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%= toolbar title: t(:label_work_package_category_plural) do -%>- <% if current_user.allowed_to?(:manage_categories, @project) %>+ <% if current_user.allowed_in_project?(:manage_categories, @project) %><li class="toolbar-item"><%= link_to_if_authorized({ controller: '/categories', action: 'new', project_id: @project },{ aria: { label: t(:label_work_package_category_new) },diff --git a/app/views/projects/settings/versions/show.html.erb b/app/views/projects/settings/versions/show.html.erbindex 48cc9c6e8c6..7782743e11c 100644--- a/app/views/projects/settings/versions/show.html.erb+++ b/app/views/projects/settings/versions/show.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%= toolbar title: t(:label_version_plural) do %>- <% if current_user.allowed_to?(:manage_versions, @project) %>+ <% if current_user.allowed_in_project?(:manage_versions, @project) %><li class="toolbar-item"><%= link_to_if_authorized({ controller: '/versions', action: 'new', project_id: @project },{ class: 'button -alt-highlight',diff --git a/app/views/repositories/_repository_header.html.erb b/app/views/repositories/_repository_header.html.erbindex 4d56b4767d2..2570d164e48 100644--- a/app/views/repositories/_repository_header.html.erb+++ b/app/views/repositories/_repository_header.html.erb@@ -57,7 +57,7 @@ See COPYRIGHT and LICENSE files for more details.</a></li><% end %>- <% if !empty && User.current.allowed_to?(:browse_repository, @project) %>+ <% if !empty && User.current.allowed_in_project?(:browse_repository, @project) %><li class="toolbar-item -icon-only"><%= link_to stats_project_repository_path(@project),class: 'button', title: t(:label_statistics) do %>@@ -67,7 +67,7 @@ See COPYRIGHT and LICENSE files for more details.<% end %><%= call_hook(:repositories_navigation_toolbar,{ repository: @repository, project: @project, repository_empty: empty }) %>- <% if User.current.allowed_to?(:manage_repository, @project) %>+ <% if User.current.allowed_in_project?(:manage_repository, @project) %><li class="toolbar-item -icon-only"><%= link_to project_settings_repository_path(@project),class: 'button', title: t(:label_setting_plural) do %>diff --git a/app/views/repositories/revision.html.erb b/app/views/repositories/revision.html.erbindex 9175c5bf9bc..341dd13893f 100644--- a/app/views/repositories/revision.html.erb+++ b/app/views/repositories/revision.html.erb@@ -60,7 +60,7 @@ See COPYRIGHT and LICENSE files for more details.<% end %></ul><% end %>-<% if User.current.allowed_to?(:browse_repository, @project) %>+<% if User.current.allowed_in_project?(:browse_repository, @project) %><h3><%= t(:label_attachment_plural) %></h3><ul id="changes-legend"><li class="change change-A icon icon-add" title=<%= t(:label_added) %>><%= t(:label_added) %></li>diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erbindex e8b8172285a..a0731f27b2f 100644--- a/app/views/versions/show.html.erb+++ b/app/views/versions/show.html.erb@@ -66,7 +66,7 @@ See COPYRIGHT and LICENSE files for more details.<%= render partial: 'versions/overview', locals: { version: @version } %></div>- <% if @version.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %>+ <% if @version.estimated_hours > 0 || User.current.allowed_in_project?(:view_time_entries, @project) %><div class="widget-box -thin"><fieldset class="form--fieldset"><legend class="form--fieldset-legend"><%= t(:label_estimates_and_time) %></legend>@@ -75,7 +75,7 @@ See COPYRIGHT and LICENSE files for more details.<td width="130px" align="right"><%= Version.human_attribute_name(:estimated_hours) %></td><td width="240px" class="total-hours" align="right"><%= html_hours(l_hours(@version.estimated_hours)) %></td></tr>- <% if User.current.allowed_to?(:view_time_entries, @project) %>+ <% if User.current.allowed_in_project?(:view_time_entries, @project) %><tr><td width="130px" align="right"><%= t(:label_spent_time) %></td><td width="240px" class="total-hours" align="right"><%= html_hours(l_hours(@version.spent_hours)) %></td>diff --git a/app/views/wiki/index.html.erb b/app/views/wiki/index.html.erbindex 1eb4fa7ec8a..ebca3ac1d8b 100644--- a/app/views/wiki/index.html.erb+++ b/app/views/wiki/index.html.erb@@ -46,7 +46,7 @@ See COPYRIGHT and LICENSE files for more details.<% unless @pages.empty? %><%= other_formats_links do |f| %><%= f.link_to 'Atom', url: {controller: '/activities', action: 'index', show_wiki_edits: 1, key: User.current.rss_key} %>- <%= f.link_to('HTML', url: {action: 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>+ <%= f.link_to('HTML', url: {action: 'export'}) if User.current.allowed_in_project?(:export_wiki_pages, @project) %><% end %><% else %><%= no_results_box(action_url: new_project_wiki_path(@project),diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erbindex ed7fae1253a..89dcb1be7e3 100644--- a/app/views/wiki/show.html.erb+++ b/app/views/wiki/show.html.erb@@ -41,7 +41,7 @@ See COPYRIGHT and LICENSE files for more details.<%= toolbar title: title, html: {class: '-with-dropdown'} do %><% if @editable %>- <% if @page && User.current.allowed_to?(:edit_wiki_pages, @project) %>+ <% if @page && User.current.allowed_in_project?(:edit_wiki_pages, @project) %><li class="toolbar-item"><%= link_to({controller: '/wiki', action: 'new_child', project_id: @project.identifier, id: @page},{ class: 'button -alt-highlight',@@ -106,7 +106,7 @@ See COPYRIGHT and LICENSE files for more details.}%></li>- <% if User.current.allowed_to?(:export_wiki_pages, @project) %>+ <% if User.current.allowed_in_project?(:export_wiki_pages, @project) %><section data-augmented-model-wrapperdata-modal-class-name="wiki-export---modal"><li>diff --git a/app/views/work_packages/bulk/edit.html.erb b/app/views/work_packages/bulk/edit.html.erbindex 373f4c3ab6a..149d76d5893 100644--- a/app/views/work_packages/bulk/edit.html.erb+++ b/app/views/work_packages/bulk/edit.html.erb@@ -139,7 +139,7 @@ See COPYRIGHT and LICENSE files for more details.<%= styled_text_field_tag 'work_package[subject]', '', size: 10 %></div></div>- <% if @project && User.current.allowed_to?(:manage_subtasks, @project) %>+ <% if @project && User.current.allowed_in_project?(:manage_subtasks, @project) %><div class="form--field"><%= styled_label_tag :work_package_parent_id, WorkPackage.human_attribute_name(:parent) %><div class="form--field-container">diff --git a/modules/backlogs/app/views/rb_impediments/_impediment.html.erb b/modules/backlogs/app/views/rb_impediments/_impediment.html.erbindex 0142ae4147f..655e00857bf 100644--- a/modules/backlogs/app/views/rb_impediments/_impediment.html.erb+++ b/modules/backlogs/app/views/rb_impediments/_impediment.html.erb@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<% prevent_edit = User.current.allowed_to?(:edit_work_packages, defined?(project) ? project : impediment.project) ? '' : 'prevent_edit'%>+<% prevent_edit = User.current.allowed_in_project?(:edit_work_packages, defined?(project) ? project : impediment.project) ? '' : 'prevent_edit'%><div class="model work_package impediment <%= color_contrast_class(impediment) %> <%= prevent_edit %> <%= mark_if_closed(impediment) %><%= color_contrast_class(impediment) %>" id="work_package_<%= impediment.id %>" <%= build_inline_style(impediment) %>><div class="id"><div class="t"><%= work_package_link_or_empty(impediment) %></div>diff --git a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb b/modules/backlogs/app/views/rb_sprints/_sprint.html.erbindex 3ab6e0f673c..846647f38d8 100644--- a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb+++ b/modules/backlogs/app/views/rb_sprints/_sprint.html.erb@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.<div class="v"><%= id_or_empty(sprint) %></div></div>- <% User.current.allowed_to?(:update_sprints, @project) ? editable = "editable" : editable = "" %>+ <% User.current.allowed_in_project?(:update_sprints, @project) ? editable = "editable" : editable = "" %><div class="show"><div class="effective_date date <%= editable %>" fieldname="effective_date" field_id=<%= sprint.id %>>@@ -45,7 +45,7 @@ See COPYRIGHT and LICENSE files for more details.<div class="name <%= editable %>" fieldname="name" field_id="<%= sprint.id %>"><%= sprint.name %></div></div>- <% if User.current.allowed_to?(:update_sprints, @project) %>+ <% if User.current.allowed_in_project?(:update_sprints, @project) %><div class="editors permanent"><%= angular_component_tag "op-basic-single-date-picker",inputs: {diff --git a/modules/backlogs/app/views/rb_taskboards/show.html.erb b/modules/backlogs/app/views/rb_taskboards/show.html.erbindex d4389c1c62d..67ec1c4b6cb 100644--- a/modules/backlogs/app/views/rb_taskboards/show.html.erb+++ b/modules/backlogs/app/views/rb_taskboards/show.html.erb@@ -58,7 +58,7 @@ See COPYRIGHT and LICENSE files for more details.<table id="impediments" class="board" cellspacing="0"><tr><td><div class="label_sprint_impediments"><%= t(:label_sprint_impediments) %></div></td>- <% if User.current.allowed_to?(:add_work_packages, @project) %>+ <% if User.current.allowed_in_project?(:add_work_packages, @project) %><td class ="add_new clickable">+</td><% else %><td class ="add_new"></td>@@ -102,7 +102,7 @@ See COPYRIGHT and LICENSE files for more details.</div></div></td>- <% if User.current.allowed_to?(:add_work_packages, @project) %>+ <% if User.current.allowed_in_project?(:add_work_packages, @project) %><td class ="add_new clickable">+</td><% else %><td class ="add_new"></td>diff --git a/modules/backlogs/app/views/rb_tasks/_task.html.erb b/modules/backlogs/app/views/rb_tasks/_task.html.erbindex 2d0a4b666b9..cc6a54ba979 100644--- a/modules/backlogs/app/views/rb_tasks/_task.html.erb+++ b/modules/backlogs/app/views/rb_tasks/_task.html.erb@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<% prevent_edit = User.current.allowed_to?(:edit_work_packages, defined?(project) ? project : task.project) ? '' : 'prevent_edit'%>+<% prevent_edit = User.current.allowed_in_project?(:edit_work_packages, defined?(project) ? project : task.project) ? '' : 'prevent_edit'%><div class="model work_package task <%= color_contrast_class(task) %> <%= prevent_edit %> <%= mark_if_closed(task) %>" id="work_package_<%= task.id %>" <%= build_inline_style(task) %>><div class="id"><div class="t"><%= work_package_link_or_empty(task) %></div>diff --git a/modules/bim/app/views/bim/bcf/issues/configure_non_members.html.erb b/modules/bim/app/views/bim/bcf/issues/configure_non_members.html.erbindex 6d666dc519c..d68dd121e82 100644--- a/modules/bim/app/views/bim/bcf/issues/configure_non_members.html.erb+++ b/modules/bim/app/views/bim/bcf/issues/configure_non_members.html.erb@@ -5,7 +5,7 @@error_objects: @importer.aggregations.non_members,error_default_text: t('bcf.bcf_xml.import.unknown_property')} %><% if @roles.any? %>- <% if User.current.allowed_to?(:manage_members, @project) %>+ <% if User.current.allowed_in_project?(:manage_members, @project) %><%= render partial: 'import_solution', locals: { solution_select_id: 'non_members_chose_role_ids',hidden_field_identifier: 'non_members_action',diff --git a/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erbindex 986945350a5..6417a677d8c 100644--- a/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/index.html.erb@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.<% html_title(t('ifc_models.label_ifc_models')) -%><%= toolbar title: t('ifc_models.label_ifc_models') do %>- <% if User.current.allowed_to?(:manage_ifc_models, @project) %>+ <% if User.current.allowed_in_project?(:manage_ifc_models, @project) %><li class="toolbar-item"><%= link_to new_bcf_project_ifc_model_path,{ class: 'button -alt-highlight',diff --git a/modules/budgets/app/views/budgets/_show.html.erb b/modules/budgets/app/views/budgets/_show.html.erbindex 74b7fc4e596..b7ac5238cc4 100644--- a/modules/budgets/app/views/budgets/_show.html.erb+++ b/modules/budgets/app/views/budgets/_show.html.erb@@ -96,7 +96,7 @@ See COPYRIGHT and LICENSE files for more details.</tr><% end %></tbody>- <% if User.current.allowed_to?(:view_cost_rates, @project) %>+ <% if User.current.allowed_in_project?(:view_cost_rates, @project) %><tfoot><tr><td colspan="3"></td>@@ -198,7 +198,7 @@ See COPYRIGHT and LICENSE files for more details.<% end %><% end %></tbody>- <% if User.current.allowed_to?(:view_cost_rates, @project) %>+ <% if User.current.allowed_in_project?(:view_cost_rates, @project) %><tfoot><tr><td colspan="3"></td>@@ -293,7 +293,7 @@ See COPYRIGHT and LICENSE files for more details.</tr><% end %></tbody>- <% if User.current.allowed_to?(:view_hourly_rates, @project) || User.current.allowed_to?(:view_own_hourly_rate, @project) %>+ <% if User.current.allowed_in_project?(:view_hourly_rates, @project) || User.current.allowed_in_project?(:view_own_hourly_rate, @project) %><tfoot><tr><td colspan="3"></td>diff --git a/modules/budgets/app/views/budgets/items/_labor_budget_item.html.erb b/modules/budgets/app/views/budgets/items/_labor_budget_item.html.erbindex ae4aaf691e0..33ed51c94ea 100644--- a/modules/budgets/app/views/budgets/items/_labor_budget_item.html.erb+++ b/modules/budgets/app/views/budgets/items/_labor_budget_item.html.erb@@ -81,7 +81,7 @@ See COPYRIGHT and LICENSE files for more details.<label class="hidden-for-sighted" for="<%= id_prefix %>_comments"><%= LaborBudgetItem.human_attribute_name(:comments) %></label><%= cost_form.text_field :comments, index: id_or_index, size: 40 %></td>- <% if User.current.allowed_to?(:view_cost_rates, @project) %>+ <% if User.current.allowed_in_project?(:view_cost_rates, @project) %><td class="currency form--td budget-table--fields"><%# Keep current budget as hidden field because otherwise they will be overridden %><% if templated == false && labor_budget_item.overridden_costs? %>diff --git a/modules/budgets/app/views/budgets/items/_material_budget_item.html.erb b/modules/budgets/app/views/budgets/items/_material_budget_item.html.erbindex c4067ab0ab8..c4aa61a58fc 100644--- a/modules/budgets/app/views/budgets/items/_material_budget_item.html.erb+++ b/modules/budgets/app/views/budgets/items/_material_budget_item.html.erb@@ -83,7 +83,7 @@ See COPYRIGHT and LICENSE files for more details.<label class="hidden-for-sighted" for="<%= id_prefix %>_comments"><%= MaterialBudgetItem.human_attribute_name(:comments) %></label><%= cost_form.text_field :comments, index: id_or_index, size: 40 %></td>- <% if User.current.allowed_to? :view_cost_rates, @project %>+ <% if User.current.allowed_in_project? :view_cost_rates, @project %><td class="currency form--td budget-table--fields"><%# Keep current budget as hidden field because otherwise they will be overridden %><% if templated == false && material_budget_item.overridden_costs? %>diff --git a/modules/budgets/app/views/budgets/subform/_labor_budget_subform.html.erb b/modules/budgets/app/views/budgets/subform/_labor_budget_subform.html.erbindex 71015df1d2f..69640a20ea8 100644--- a/modules/budgets/app/views/budgets/subform/_labor_budget_subform.html.erb+++ b/modules/budgets/app/views/budgets/subform/_labor_budget_subform.html.erb@@ -43,7 +43,7 @@ end -%><col opHighlightCol><col opHighlightCol><col opHighlightCol>- <% if User.current.allowed_to?(:view_cost_rates, @project)%>+ <% if User.current.allowed_in_project?(:view_cost_rates, @project)%><col opHighlightCol><%end%><col>@@ -77,7 +77,7 @@ end -%></div></div></th>- <% if User.current.allowed_to?(:view_cost_rates, @project)%>+ <% if User.current.allowed_in_project?(:view_cost_rates, @project)%><th class="currency" id="labor_budget_items_price"><div class="generic-table--sort-header-outer"><div class="generic-table--sort-header">diff --git a/modules/budgets/app/views/budgets/subform/_material_budget_subform.html.erb b/modules/budgets/app/views/budgets/subform/_material_budget_subform.html.erbindex 68e424d0abb..f9ee47b544d 100644--- a/modules/budgets/app/views/budgets/subform/_material_budget_subform.html.erb+++ b/modules/budgets/app/views/budgets/subform/_material_budget_subform.html.erb@@ -42,7 +42,7 @@ See COPYRIGHT and LICENSE files for more details.<col opHighlightCol><col opHighlightCol><col opHighlightCol>- <% if User.current.allowed_to?(:view_cost_rates, @project)%>+ <% if User.current.allowed_in_project?(:view_cost_rates, @project)%><col opHighlightCol><%end%><col>@@ -85,7 +85,7 @@ See COPYRIGHT and LICENSE files for more details.</div></div></th>- <% if User.current.allowed_to?(:view_cost_rates, @project)%>+ <% if User.current.allowed_in_project?(:view_cost_rates, @project)%><th class="currency" id="material_budget_items_price"><div class="generic-table--sort-header-outer"><div class="generic-table--sort-header">diff --git a/modules/costs/app/views/costlog/edit.html.erb b/modules/costs/app/views/costlog/edit.html.erbindex a69199582d9..3d90a9525d6 100644--- a/modules/costs/app/views/costlog/edit.html.erb+++ b/modules/costs/app/views/costlog/edit.html.erb@@ -65,7 +65,7 @@ See COPYRIGHT and LICENSE files for more details.data: { :'remote-field-key' => 'fixed_date' } %><label for="cost_entry_spent_on" class="hidden-for-sighted"><%= t(:label_date) %> <%= t(:text_hint_date_format) %></label></div>- <% if User.current.allowed_to? :log_costs, @project %>+ <% if User.current.allowed_in_project? :log_costs, @project %><div class="form--field"><%# Without knowing why `prompt` is in this case responsible for no blank line in the selection options %><%= f.select :user_id,@@ -112,7 +112,7 @@ See COPYRIGHT and LICENSE files for more details.<div class="form--field"><label for="cost_entry_costs_edit" class="form--label"><%= CostEntry.human_attribute_name(:costs) %></label>- <% if User.current.allowed_to?(:view_cost_rates, @cost_entry.project) %>+ <% if User.current.allowed_in_project?(:view_cost_rates, @cost_entry.project) %><span class="form--field-container"><a href="#"id="cost_entry_costs"diff --git a/modules/costs/app/views/hourly_rates/_list_project.html.erb b/modules/costs/app/views/hourly_rates/_list_project.html.erbindex bc6431ab431..583a9e5d9b6 100644--- a/modules/costs/app/views/hourly_rates/_list_project.html.erb+++ b/modules/costs/app/views/hourly_rates/_list_project.html.erb@@ -39,7 +39,7 @@ See COPYRIGHT and LICENSE files for more details.%><div class="user-rate-history-list"><div class="contextual">- <% if project && User.current.allowed_to?({:controller => '/hourly_rates', :action => 'edit'}, project) %>+ <% if project && User.current.allowed_in_project?({:controller => '/hourly_rates', :action => 'edit'}, project) %><%= link_to t(:button_update), {:controller => '/hourly_rates', :action => 'edit', :project_id => project, :id => @user}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %><% end %></div>diff --git a/modules/meeting/app/components/work_package_meetings_tab/heading_component.rb b/modules/meeting/app/components/work_package_meetings_tab/heading_component.rbindex 3ae9a1fd8b4..8f753ab0c63 100644--- a/modules/meeting/app/components/work_package_meetings_tab/heading_component.rb+++ b/modules/meeting/app/components/work_package_meetings_tab/heading_component.rb@@ -41,7 +41,7 @@ module WorkPackageMeetingsTabprivatedef allowed_to_add_to_meeting?- User.current.allowed_to?(:edit_meetings, @work_package.project)+ User.current.allowed_in_project?(:edit_meetings, @work_package.project)endendenddiff --git a/modules/meeting/app/views/meetings/_menu_query_select.html.erb b/modules/meeting/app/views/meetings/_menu_query_select.html.erbindex a82500a8ec8..3ff7f915a13 100644--- a/modules/meeting/app/views/meetings/_menu_query_select.html.erb+++ b/modules/meeting/app/views/meetings/_menu_query_select.html.erb@@ -65,7 +65,7 @@ See COPYRIGHT and LICENSE files for more details.</div><div class="op-sidebar--footer">- <% if User.current.allowed_to?(:create_meetings, @project, global: true) %>+ <% if (@project && User.current.allowed_in_project?(:create_meetings, @project)) || (@project.nil? && User.current.allowed_in_any_project?(:create_meetings)) %><%= button_to polymorphic_path([:new, @project, :meeting]),{ method: :get,class: 'button -alt-highlight -expand',diff --git a/modules/reporting/app/controllers/cost_reports_controller.rb b/modules/reporting/app/controllers/cost_reports_controller.rbindex e17a70f51f8..eaaf242bc68 100644--- a/modules/reporting/app/controllers/cost_reports_controller.rb+++ b/modules/reporting/app/controllers/cost_reports_controller.rb@@ -52,7 +52,7 @@ class CostReportsController < ApplicationControllerattr_accessor :report_engine, :cost_types, :unit_id, :cost_typehelper_method :current_user- helper_method :allowed_to?+ helper_method :allowed_in_report?include ReportingHelperhelper ReportingHelper@@ -358,7 +358,7 @@ class CostReportsController < ApplicationController# save_private_cost_reports permission as well## @Override- def allowed_to?(action, report, user = User.current)+ def allowed_in_report?(action, report, user = User.current) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity# admins may do everythingreturn true if user.admin?@@ -366,11 +366,6 @@ class CostReportsController < ApplicationController# should not do anything with it. It fact, this should never happen.return false if report.project.present? && report.project != @project- # If report does not belong to a project, it is ok to look for the- # permission in any project. Otherwise, the user should have the permission- # in this project.- global = report.project.nil?-permissions =case actionwhen :create@@ -384,7 +379,16 @@ class CostReportsController < ApplicationControllerwhen :save_as_public%i[save_cost_reports]end- Array(permissions).any? { |permission| user.allowed_to?(permission, @project, global:) }++ # If report does not belong to a project, it is ok to look for the+ # permission in any project. Otherwise, the user should have the permission+ # in this project.++ if report.project+ Array(permissions).any? { |permission| user.allowed_to?(permission, @project) }+ else+ Array(permissions).any? { |permission| user.allowed_in_any_project?(permission) }+ endendprivatediff --git a/modules/reporting/app/views/cost_reports/index.html.erb b/modules/reporting/app/views/cost_reports/index.html.erbindex 4a0755f3038..7c26dfeb4c9 100644--- a/modules/reporting/app/views/cost_reports/index.html.erb+++ b/modules/reporting/app/views/cost_reports/index.html.erb@@ -39,11 +39,11 @@ See COPYRIGHT and LICENSE files for more details.<div class="toolbar"><div class="title-container"><h2 id="ur_caption">- <%= render_widget Widget::Controls::QueryName, @query, :can_rename => allowed_to?(:rename, @query, current_user) %>+ <%= render_widget Widget::Controls::QueryName, @query, :can_rename => allowed_in_report?(:rename, @query, current_user) %></h2></div><ul class="toolbar-items">- <% if User.current.allowed_to? :export_work_packages, @project, global: @project.nil? %>+ <% if (@project && User.current.allowed_in_project?(:export_work_packages, @project) || (@project.nil? && User.current.allowed_in_any_project?(:export_work_packages)) %><li class="toolbar-item"><%= link_to(t(:export_to_excel),{ controller: "cost_reports" ,