2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-02 13:16:01 -05:00
|
|
|
class TrustLevelGranter
|
|
|
|
def initialize(trust_level, user)
|
|
|
|
@trust_level, @user = trust_level, user
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.grant(trust_level, user)
|
|
|
|
TrustLevelGranter.new(trust_level, user).grant
|
|
|
|
end
|
|
|
|
|
|
|
|
def grant
|
|
|
|
if @user.trust_level < @trust_level
|
|
|
|
@user.change_trust_level!(@trust_level)
|
|
|
|
@user.save!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|