Sha256: b042f71d03c80d4b86c5560d36564b5263ac84dd48d0bb5bff7daf5079f5f6cc

Contents?: true

Size: 565 Bytes

Versions: 12

Compression:

Stored size: 565 Bytes

Contents

# frozen_string_literal: true

module Osso
  module GraphQL
    module Resolvers
      class EnterpriseAccount < ::GraphQL::Schema::Resolver
        type Types::EnterpriseAccount, null: false

        def resolve(args)
          return unless admin? || enterprise_authorized?(args[:domain])

          Osso::Models::EnterpriseAccount.find_by(domain: args[:domain])
        end

        def admin?
          context[:scope] == :admin
        end

        def enterprise_authorized?(domain)
          context[:scope] == domain
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
osso-0.0.3.16 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.15 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.14 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.13 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.12 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.11 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.9 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.8 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.7 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.6 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.5 lib/osso/graphql/resolvers/enterprise_account.rb
osso-0.0.3.4 lib/osso/graphql/resolvers/enterprise_account.rb