2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-02 13:16:01 -05:00
|
|
|
module Jobs
|
|
|
|
|
2019-10-02 00:01:53 -04:00
|
|
|
class BulkGrantTrustLevel < ::Jobs::Base
|
2017-03-02 13:16:01 -05:00
|
|
|
|
|
|
|
def execute(args)
|
|
|
|
trust_level = args[:trust_level]
|
|
|
|
user_ids = args[:user_ids]
|
|
|
|
|
|
|
|
raise Discourse::InvalidParameters.new(:trust_level) if trust_level.blank?
|
|
|
|
raise Discourse::InvalidParameters.new(:user_ids) if user_ids.blank?
|
|
|
|
|
|
|
|
User.where(id: user_ids).find_each do |user|
|
|
|
|
TrustLevelGranter.grant(trust_level, user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|