2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
class OauthAccessToken < Doorkeeper::AccessToken
|
2016-06-02 11:05:42 +05:30
|
|
|
belongs_to :resource_owner, class_name: 'User'
|
|
|
|
belongs_to :application, class_name: 'Doorkeeper::Application'
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
alias_attribute :user, :resource_owner
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
scope :distinct_resource_owner_counts, ->(applications) { where(application: applications).distinct.group(:application_id).count(:resource_owner_id) }
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def scopes=(value)
|
|
|
|
if value.is_a?(Array)
|
|
|
|
super(Doorkeeper::OAuth::Scopes.from_array(value).to_s)
|
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|