Sha256: 37a2b1fb8a52b386970e149f9948acbb0a4f3f48e7f7c8f9f57085172fefcb0b

Contents?: true

Size: 1003 Bytes

Versions: 19

Compression:

Stored size: 1003 Bytes

Contents

module SocialStream
  module Oauth2Server
    module Models
      module User
        extend ActiveSupport::Concern

        included do
          has_many :oauth2_tokens,
                   dependent: :destroy

          has_many :authorization_codes,
                   class_name: 'Oauth2Token::AuthorizationCode'

          has_many :access_tokens,
                   class_name: 'Oauth2Token::AccessToken'

          has_many :refresh_tokens,
                   class_name: 'Oauth2Token::RefreshToken'
        end

        # Is {#client} authorized by this {User}
        def client_authorized?(client)
          contact_to!(client).relation_ids.include? Relation::Auth.instance.id
        end

        # Create a new tie to {Site::Client}
        def client_authorize!(client)
          unless contact_to!(client).relation_ids.include?(Relation::Auth.instance.id)
            contact_to!(client).relation_ids += [ Relation::Auth.instance.id ]
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
social_stream-2.1.1 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.1.1 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.1.0 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.1.0 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.4 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.0.3 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.3 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.0.2 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.2 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.0.1 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.1 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.0 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.0.0 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.0.beta3 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.0.0.beta3 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.0.beta2 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.0.0.beta2 lib/social_stream/oauth2_server/models/user.rb
social_stream-2.0.0.beta1 oauth2_server/lib/social_stream/oauth2_server/models/user.rb
social_stream-oauth2_server-2.0.0.beta1 lib/social_stream/oauth2_server/models/user.rb