You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cartodb/lib/carto/user_updater.rb

23 lines
727 B

module Carto
class UserUpdater
4 years ago
def initialize(user)
# TODO: this needs to be a ::User for this to work. We need to
# progress in the synchronizable concern, in particular the
# method set_fields_from_central at least
@user = user.sequel_user
end
def update!(user_param)
# Copied from Superadmin::UsersController#update
@user.set_fields_from_central(user_param, :update)
@user.update_feature_flags(user_param[:feature_flags])
@user.regenerate_api_key(user_param[:api_key]) if user_param[:api_key].present?
@user.update_rate_limits(user_param[:rate_limit])
@user.update_do_subscription(user_param[:do_subscription])
@user.save!
end
4 years ago
end
end