Module: MnoEnterprise::Concerns::Controllers::PagesController

Extended by:
ActiveSupport::Concern
Includes:
ImageHelper
Included in:
PagesController
Defined in:
lib/mno_enterprise/concerns/controllers/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#app_access_unauthorizedObject

GET /app_access_unauthorized



45
46
47
48
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 45

def app_access_unauthorized
  @meta[:title] = "Unauthorized"
  @meta[:description] = "Application access not granted"
end

#app_logoutObject

GET /app_logout



56
57
58
59
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 56

def app_logout
  @meta[:title] = "Logged out"
  @meta[:description] = "Logged out from application"
end

#billing_details_requiredObject



50
51
52
53
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 50

def billing_details_required
  @meta[:title] = "Billing Details Required"
  @meta[:description] = "Billing details have not been provided"
end

#launchObject

Instance methods

GET /launch/:id Redirect to Mno Enterprise app launcher Launching an app (from dashboard) should redirect to this action The true goal of this action is to hide maestrano in the link behind any dashboard app picture

TODO: Access + existence checks could be added in the future. This is not mandatory as Mno Enterprise will do it anyway



27
28
29
30
31
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 27

def launch
  app_instance = MnoEnterprise::AppInstance.find_by(uid: params[:id])
  MnoEnterprise::EventLogger.info('app_launch', current_user.id, 'App launched', app_instance)
  redirect_to MnoEnterprise.router.launch_url(params[:id], {wtk: MnoEnterprise.jwt(user_id: current_user.uid)}.reverse_merge(request.query_parameters))
end

#loadingObject

GET /loading/:id Loading lounge - wait for an app to be online



35
36
37
38
39
40
41
42
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 35

def loading
  @app_instance = MnoEnterprise::AppInstance.where(uid: params[:id]).reload.first

  respond_to do |format|
    format.html { @app_instance_hash = app_instance_hash(@app_instance) }
    format.json { render json: app_instance_hash(@app_instance) }
  end
end

#termsObject



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 61

def terms
  @meta[:title] = 'Terms of Use'
  @meta[:description] = 'Terms of Use'

  ts = MnoEnterprise::App.order_by("updated_at.desc").first.try(:updated_at)
  @apps = if ts
    Rails.cache.fetch(['pages/terms/app-list', ts]) do
      MnoEnterprise::App.order_by("name.ac").reject{|i| i.terms_url.blank?}
    end
  else
    []
  end
end