gitlab-org--gitlab-foss/app/controllers/concerns/oauth_applications.rb
2017-09-19 01:29:32 +08:00

19 lines
407 B
Ruby

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
@scopes ||= Doorkeeper.configuration.scopes
end
end