Sha256: 5fa0ecab042b370d04c82c0db93633f13a0d115c986c58cda9c04f6262d12ab2

Contents?: true

Size: 612 Bytes

Versions: 26

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module Models
    module Scopes
      def scopes
        OAuth::Scopes.from_string(scopes_string)
      end

      def scopes=(value)
        if value.is_a?(Array)
          super(Doorkeeper::OAuth::Scopes.from_array(value).to_s)
        else
          super(Doorkeeper::OAuth::Scopes.from_string(value.to_s).to_s)
        end
      end

      def scopes_string
        self[:scopes]
      end

      def includes_scope?(*required_scopes)
        required_scopes.blank? || required_scopes.any? { |scope| scopes.exists?(scope.to_s) }
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
doorkeeper-5.8.1 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.8.0 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.7.1 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.7.0 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.9 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.8 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.7 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.6 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.5 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.4 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.3 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.2 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.1 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.0 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.0.rc2 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.6.0.rc1 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.5.4 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.5.3 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.5.2 lib/doorkeeper/models/concerns/scopes.rb
doorkeeper-5.5.1 lib/doorkeeper/models/concerns/scopes.rb