Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

atmosphere at pdp

mkasztelnik edited this page Nov 27, 2014 · 4 revisions

Atmosphere Appliance Types PDP

PDP is used to filer number of Appliance Types which can be started by the user. Default PDP implementation (DefaultPdP) does not use any external communication.

Atmosphere configuration

Atmopshere can be configured to use any PDP while filtering resources presented to the user. By default Atmosphere is shipped with DefaultPdp.

If you want to add your own Pdp than add new ruby class with with following methods:

class CustomPdp

  # We will be checking if current user can start AT
  def initialize(current_user)
    ...
  end

  # Check if Appliance Type can be started by current user 
  # in production mode.
  def can_start_in_production?(at)
    ...
  end

  # Check if Appliance Type can be started by current user 
  # in development mode.
  def can_start_in_development?(at)
    ...
  end

  # Check if Appliance Type can be managed (e.g. deleted) 
  # by current user.
  def can_manage?(at)
    ...
  end

  # - `ats` active record query, which can be further limited
  # - `filter` mode in which appliance types can be started. 
  #    Possible values are: 'production', 'development' and 
  #    'manage'
  def filter(ats, filter = nil)
    ...  
  end
end

When Pdp is ready Atmosphere need to be configured to use it. To do so add following line in rails initialize configuration file:

#e.g. your_rails_app/config/initializers/atmosphere.rb

Atmosphere.setup do |config|
  ...
  config.at_pdp_class = PdpClass
end
Clone this wiki locally