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

refactor: use User#allowed_to_globally? helper

Christophe Bliard1793883ddf9b
diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rb
index dd14f9b0632..acc951ba868 100644
--- a/modules/storages/app/models/storages/storage.rb
+++ b/modules/storages/app/models/storages/storage.rb
@@ -63,7 +63,7 @@ class Storages::Storage < ApplicationRecord
# Creates a scope of all storages, which belong to a project the user is a member
# and has the permission ':view_file_links'
scope :visible, ->(user = User.current) {
- if user.admin? || Project.allowed_to(user, :manage_storages_in_project).any?
+ if user.allowed_to_globally?(:manage_storages_in_project)
all
else
where(