Sha256: 0ef63c4c692df3eeca52355861ef0b8bc2822d508d3798a79a04d5601432a090

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

json.cache! ['v1', @user.cache_key, session[:impersonator_user_id]] do
  json.current_user do
    json.id @user.id
    json.name @user.name
    json.surname @user.surname
    json.email @user.email
    json.logged_in !!@user.id
    json.created_at @user.created_at ? @user.created_at.iso8601 : nil
    json.company @user.company
    json.phone @user.phone
    json.api_secret @user.api_secret
    json.api_key @user.api_key
    json.phone_country_code @user.phone_country_code
    json.country_code @user.geo_country_code || 'US'
    json.website @user.website
    json.sso_session @user.sso_session
    json.admin_role @user.admin_role
    json.avatar_url avatar_url(@user)
    json.tos_accepted_at @user.meta_data[:tos_accepted_at] || false
    if current_impersonator
      json.current_impersonator true
      json.current_impersonator_role current_impersonator.admin_role
    end

    if @user.respond_to?(:intercom_user_hash)
      json.user_hash @user.intercom_user_hash
    end

    # Embed association if user is persisted
    if @user.id
      json.organizations do
        json.array! (@user.organizations.active || []) do |o|
          json.id o.id
          json.uid o.uid
          json.name o.name
          json.currency o.billing_currency
          json.current_user_role o.role
          json.has_myob_essentials_only o.has_myob_essentials_only?
          json.financial_year_end_month o.financial_year_end_month
        end
      end

      if @user.deletion_request.present?
        json.deletion_request do
          json.extract! @user.deletion_request, :id, :token
        end
      end

      json.kpi_enabled !!@user.kpi_enabled
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mno-enterprise-api-3.3.3 app/views/mno_enterprise/jpi/v1/current_users/show.json.jbuilder