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

Replace `allowed_to?` calls in components

Klaus Zandersfedb1340a32b
diff --git a/app/components/work_packages/share/concerns/authorization.rb b/app/components/work_packages/share/concerns/authorization.rb
index 3cf2adddc8e..4a927c0b598 100644
--- a/app/components/work_packages/share/concerns/authorization.rb
+++ b/app/components/work_packages/share/concerns/authorization.rb
@@ -36,7 +36,7 @@ module WorkPackages
included do
def sharing_manageable?
- User.current.allowed_to?(:share_work_packages, @work_package.project)
+ User.current.allowed_in_project?(:share_work_packages, @work_package.project)
end
end
end
diff --git a/modules/bim/app/components/bim/ifc_models/row_component.rb b/modules/bim/app/components/bim/ifc_models/row_component.rb
index 73ea4c4c9eb..224a62b11ef 100644
--- a/modules/bim/app/components/bim/ifc_models/row_component.rb
+++ b/modules/bim/app/components/bim/ifc_models/row_component.rb
@@ -57,7 +57,7 @@ module Bim
links << download_link
end
- if User.current.allowed_to?(:manage_ifc_models, model.project)
+ if User.current.allowed_in_project?(:manage_ifc_models, model.project)
links.push(edit_link, delete_link)
else
links
diff --git a/modules/boards/app/components/boards/add_button_component.rb b/modules/boards/app/components/boards/add_button_component.rb
index cb04764be20..f8063e881f5 100644
--- a/modules/boards/app/components/boards/add_button_component.rb
+++ b/modules/boards/app/components/boards/add_button_component.rb
@@ -33,7 +33,7 @@ module Boards
class AddButtonComponent < ::AddButtonComponent
def render?
if current_project
- User.current.allowed_to?(:manage_board_views, current_project)
+ User.current.allowed_in_project?(:manage_board_views, current_project)
else
User.current.allowed_in_any_project?(:manage_board_views)
end
diff --git a/modules/boards/app/components/boards/row_component.rb b/modules/boards/app/components/boards/row_component.rb
index e636e488e8a..b81812cb991 100644
--- a/modules/boards/app/components/boards/row_component.rb
+++ b/modules/boards/app/components/boards/row_component.rb
@@ -74,7 +74,7 @@ module Boards
private
def render_delete_link?
- table.current_project && table.current_user.allowed_to?(:manage_board_views, table.current_project)
+ table.current_project && table.current_user.allowed_in_project?(:manage_board_views, table.current_project)
end
end
end
diff --git a/modules/calendar/app/components/calendar/add_button_component.rb b/modules/calendar/app/components/calendar/add_button_component.rb
index 2ec86e18e65..5873c19f240 100644
--- a/modules/calendar/app/components/calendar/add_button_component.rb
+++ b/modules/calendar/app/components/calendar/add_button_component.rb
@@ -33,7 +33,7 @@ module Calendar
class AddButtonComponent < ::AddButtonComponent
def render?
if current_project
- User.current.allowed_to?(:manage_calendars, current_project)
+ User.current.allowed_in_project?(:manage_calendars, current_project)
else
User.current.allowed_in_any_project?(:manage_calendars)
end
diff --git a/modules/calendar/app/components/calendar/row_component.rb b/modules/calendar/app/components/calendar/row_component.rb
index db9a03f48cc..c29d3810a07 100644
--- a/modules/calendar/app/components/calendar/row_component.rb
+++ b/modules/calendar/app/components/calendar/row_component.rb
@@ -69,7 +69,7 @@ module Calendar
private
def render_delete_link?
- table.current_project && table.current_user.allowed_to?(:manage_calendars, project)
+ table.current_project && table.current_user.allowed_in_project?(:manage_calendars, project)
end
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/form_component.rb b/modules/meeting/app/components/meeting_agenda_items/form_component.rb
index 8ea83e3d536..5129f725856 100644
--- a/modules/meeting/app/components/meeting_agenda_items/form_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/form_component.rb
@@ -44,7 +44,7 @@ module MeetingAgendaItems
end
def render?
- User.current.allowed_to?(:manage_agendas, @meeting.project)
+ User.current.allowed_in_project?(:manage_agendas, @meeting.project)
end
private
@@ -57,15 +57,12 @@ module MeetingAgendaItems
}
end
-
def display_notes_input_value
@meeting_agenda_item.notes.blank? ? :none : nil
end
-
def display_notes_add_button_value
@meeting_agenda_item.notes.blank? ? nil : :none
end
-
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
index 4b32ae9ccd4..eae7805f24e 100644
--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
@@ -42,11 +42,11 @@ module MeetingAgendaItems
private
def drag_and_drop_enabled?
- @meeting.open? && User.current.allowed_to?(:manage_agendas, @meeting.project)
+ @meeting.open? && User.current.allowed_in_project?(:manage_agendas, @meeting.project)
end
def edit_enabled?
- @meeting.open? && User.current.allowed_to?(:manage_agendas, @meeting.project)
+ @meeting.open? && User.current.allowed_in_project?(:manage_agendas, @meeting.project)
end
def edit_action_item(menu)
diff --git a/modules/meeting/app/components/meeting_agenda_items/new_button_component.rb b/modules/meeting/app/components/meeting_agenda_items/new_button_component.rb
index 0ebbe726c6e..ff2f16e4222 100644
--- a/modules/meeting/app/components/meeting_agenda_items/new_button_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/new_button_component.rb
@@ -41,7 +41,7 @@ module MeetingAgendaItems
end
def render?
- User.current.allowed_to?(:manage_agendas, @meeting.project)
+ User.current.allowed_in_project?(:manage_agendas, @meeting.project)
end
end
end
diff --git a/modules/meeting/app/components/meetings/add_button_component.rb b/modules/meeting/app/components/meetings/add_button_component.rb
index 2f4b1f56937..84c8856fcc3 100644
--- a/modules/meeting/app/components/meetings/add_button_component.rb
+++ b/modules/meeting/app/components/meetings/add_button_component.rb
@@ -33,7 +33,7 @@ module Meetings
class AddButtonComponent < ::AddButtonComponent
def render?
if current_project
- User.current.allowed_to?(:create_meetings, current_project)
+ User.current.allowed_in_project?(:create_meetings, current_project)
else
User.current.allowed_in_any_project?(:create_meetings)
end
diff --git a/modules/meeting/app/components/meetings/header_component.rb b/modules/meeting/app/components/meetings/header_component.rb
index 9326e83ce02..6e4c1402705 100644
--- a/modules/meeting/app/components/meetings/header_component.rb
+++ b/modules/meeting/app/components/meetings/header_component.rb
@@ -49,7 +49,7 @@ module Meetings
end
def delete_enabled?
- User.current.allowed_to?(:delete_meetings, @meeting.project)
+ User.current.allowed_in_project?(:delete_meetings, @meeting.project)
end
def last_updated_at
@@ -58,6 +58,5 @@ module Meetings
[latest_agenda_update, latest_meeting_update].max
end
-
end
end
diff --git a/modules/meeting/app/components/meetings/sidebar/details_form_component.rb b/modules/meeting/app/components/meetings/sidebar/details_form_component.rb
index 9f42e53fe39..18c3c0f5dd2 100644
--- a/modules/meeting/app/components/meetings/sidebar/details_form_component.rb
+++ b/modules/meeting/app/components/meetings/sidebar/details_form_component.rb
@@ -39,7 +39,7 @@ module Meetings
end
def render?
- User.current.allowed_to?(:edit_meetings, @meeting.project)
+ User.current.allowed_in_project?(:edit_meetings, @meeting.project)
end
private
@@ -51,6 +51,5 @@ module Meetings
def start_time_initial_value
@meeting.start_time&.strftime("%H:%M")
end
-
end
end
diff --git a/modules/meeting/app/components/meetings/sidebar/participants_form_component.rb b/modules/meeting/app/components/meetings/sidebar/participants_form_component.rb
index 735ada84f44..4b884f58f8d 100644
--- a/modules/meeting/app/components/meetings/sidebar/participants_form_component.rb
+++ b/modules/meeting/app/components/meetings/sidebar/participants_form_component.rb
@@ -40,8 +40,7 @@ module Meetings
end
def render?
- User.current.allowed_to?(:edit_meetings, @meeting.project)
+ User.current.allowed_in_project?(:edit_meetings, @meeting.project)
end
-
end
end
diff --git a/modules/meeting/app/components/meetings/sidebar/state_component.rb b/modules/meeting/app/components/meetings/sidebar/state_component.rb
index 5a28f499102..f7f81093482 100644
--- a/modules/meeting/app/components/meetings/sidebar/state_component.rb
+++ b/modules/meeting/app/components/meetings/sidebar/state_component.rb
@@ -41,7 +41,7 @@ module Meetings
private
def edit_enabled?
- User.current.allowed_to?(:close_meeting_agendas, @meeting.project)
+ User.current.allowed_in_project?(:close_meeting_agendas, @meeting.project)
end
end
end
diff --git a/modules/team_planner/app/components/team_planner/add_button_component.rb b/modules/team_planner/app/components/team_planner/add_button_component.rb
index f8a7f7823e4..3804d9a6f83 100644
--- a/modules/team_planner/app/components/team_planner/add_button_component.rb
+++ b/modules/team_planner/app/components/team_planner/add_button_component.rb
@@ -33,7 +33,7 @@ module TeamPlanner
class AddButtonComponent < ::AddButtonComponent
def render?
if current_project
- User.current.allowed_to?(:manage_team_planner, current_project)
+ User.current.allowed_in_project?(:manage_team_planner, current_project)
else
User.current.allowed_in_any_project?(:manage_team_planner)
end
diff --git a/modules/team_planner/app/components/team_planner/row_component.rb b/modules/team_planner/app/components/team_planner/row_component.rb
index 7278d9322e1..bff32fd3388 100644
--- a/modules/team_planner/app/components/team_planner/row_component.rb
+++ b/modules/team_planner/app/components/team_planner/row_component.rb
@@ -54,7 +54,7 @@ module TeamPlanner
end
def delete_link
- if table.current_user.allowed_to?(:manage_team_planner, project)
+ if table.current_user.allowed_in_project?(:manage_team_planner, project)
link_to(
'',
project_team_planner_path(project, query.id),