debian-mirror-gitlab/app/models/concerns/bulk_member_access_load.rb

20 lines
649 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module BulkMemberAccessLoad
extend ActiveSupport::Concern
included do
2021-12-07 22:27:20 +05:30
def merge_value_to_request_store(resource_klass, resource_id, value)
2022-05-07 20:08:51 +05:30
Gitlab::SafeRequestLoader.execute(resource_key: max_member_access_for_resource_key(resource_klass),
resource_ids: [resource_id],
default_value: Gitlab::Access::NO_ACCESS) do
2021-04-29 21:17:54 +05:30
{ resource_id => value }
end
end
2022-05-07 20:08:51 +05:30
def max_member_access_for_resource_key(klass)
"max_member_access_for_#{klass.name.underscore.pluralize}:#{self.class}:#{self.id}"
2021-04-29 21:17:54 +05:30
end
2018-03-17 18:26:18 +05:30
end
end