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

linting

ulfertsbacc96fd86cb
diff --git a/app/models/user.rb b/app/models/user.rb
index 55bd055c8d0..1fec99fee6a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -501,15 +501,18 @@ class User < Principal
end
# Returns true if user is arg or belongs to arg
+ # rubocop:disable Naming/PredicateName
def is_or_belongs_to?(arg)
- if arg.is_a?(User)
+ case arg
+ when User
self == arg
- elsif arg.is_a?(Group)
+ when Group
arg.users.include?(self)
else
false
end
end
+ # rubocop:enable Naming/PredicateName
def self.allowed(action, project)
Authorization.users(action, project)
@@ -531,9 +534,7 @@ class User < Principal
authorization_service.call(action, nil, options.merge(global: true)).result
end
- def preload_projects_allowed_to(action)
- authorization_service.preload_projects_allowed_to(action)
- end
+ delegate :preload_projects_allowed_to, to: :authorization_service
def reported_work_package_count
WorkPackage.on_active_project.with_author(self).visible.count