Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/application_record.rb')
-rw-r--r--app/models/application_record.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 3ad25a7e555..d362cfac4be 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -103,4 +103,12 @@ class ApplicationRecord < ActiveRecord::Base
def self.cached_column_list
self.column_names.map { |column_name| self.arel_table[column_name] }
end
+
+ def readable_by?(user)
+ Ability.allowed?(user, "read_#{to_ability_name}".to_sym, self)
+ end
+
+ def to_ability_name
+ model_name.element
+ end
end