Sha256: fe33f9f2ee213201e61fd0f37f323159548d40dd599e5f35224f01a83f83f20d

Contents?: true

Size: 928 Bytes

Versions: 8

Compression:

Stored size: 928 Bytes

Contents

# frozen_string_literal: true
module DiscourseApi
  module API
    module SSO
      def sync_sso(params = {})
        sso = DiscourseApi::SingleSignOn.new
        sso.sso_secret = params[:sso_secret]
        sso.name = params[:name]
        sso.username = params[:username]
        sso.email = params[:email]
        sso.external_id = params[:external_id]
        sso.suppress_welcome_message = params[:suppress_welcome_message] === true
        sso.avatar_url = params[:avatar_url]
        sso.title = params[:title]
        sso.avatar_force_update = params[:avatar_force_update] === true
        sso.add_groups = params[:add_groups]
        sso.remove_groups = params[:remove_groups]
        params.keys.select { |key| key.to_s.start_with?("custom") }.each do |custom_key|
          sso.custom_fields[custom_key] = params[custom_key]
        end

        post("/admin/users/sync_sso", sso.payload)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
discourse_api-0.39.3 lib/discourse_api/api/sso.rb
discourse_api-0.39.2 lib/discourse_api/api/sso.rb
discourse_api-0.39.1 lib/discourse_api/api/sso.rb
discourse_api-0.39.0 lib/discourse_api/api/sso.rb
discourse_api-0.38.0 lib/discourse_api/api/sso.rb
discourse_api-0.37.0 lib/discourse_api/api/sso.rb
discourse_api-0.36.0 lib/discourse_api/api/sso.rb
discourse_api-0.35.0 lib/discourse_api/api/sso.rb