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

Extended by:
ActiveSupport::Concern
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



43
44
45
46
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 43

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

#app_logoutObject

GET /app_logout



54
55
56
57
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 54

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

#billing_details_requiredObject



48
49
50
51
# File 'lib/mno_enterprise/concerns/controllers/pages_controller.rb', line 48

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



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

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



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

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



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

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