2016-11-22 03:57:31 -05:00
|
|
|
module OauthApplications
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
before_action :prepare_scopes, only: [:create, :update]
|
|
|
|
end
|
|
|
|
|
|
|
|
def prepare_scopes
|
2016-12-16 16:59:53 -05:00
|
|
|
scopes = params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil)
|
2016-11-24 02:37:22 -05:00
|
|
|
|
2016-11-22 03:57:31 -05:00
|
|
|
if scopes
|
|
|
|
params[:doorkeeper_application][:scopes] = scopes.join(' ')
|
|
|
|
end
|
|
|
|
end
|
2016-11-24 02:37:22 -05:00
|
|
|
|
|
|
|
def load_scopes
|
|
|
|
@scopes = Doorkeeper.configuration.scopes
|
|
|
|
end
|
2016-11-22 03:57:31 -05:00
|
|
|
end
|