BigW Consortium Gitlab

oauth_applications.rb 405 Bytes
Newer Older
1 2 3 4 5 6 7 8
module OauthApplications
  extend ActiveSupport::Concern

  included do
    before_action :prepare_scopes, only: [:create, :update]
  end

  def prepare_scopes
9
    scopes = params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil)
10

11 12 13 14
    if scopes
      params[:doorkeeper_application][:scopes] = scopes.join(' ')
    end
  end
15 16 17 18

  def load_scopes
    @scopes = Doorkeeper.configuration.scopes
  end
19
end