2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module OauthApplications
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
before_action :prepare_scopes, only: [:create, :update]
|
|
|
|
end
|
|
|
|
|
|
|
|
def prepare_scopes
|
|
|
|
scopes = params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil)
|
|
|
|
|
|
|
|
if scopes
|
|
|
|
params[:doorkeeper_application][:scopes] = scopes.join(' ')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def load_scopes
|
2018-03-17 18:26:18 +05:30
|
|
|
@scopes ||= Doorkeeper.configuration.scopes
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|