Class: DbmsEngineController

Inherits:
ApplicationController
  • Object
show all
Includes:
DbmsEngineHelper, DbmsPluginHelper
Defined in:
app/controllers/dbms_engine_controller.rb

Constant Summary collapse

APP_CONFIG =

Load configuration items (MANDATORY, must be included)

HashWithIndifferentAccess.new(YAML.load(File.read(File.expand_path('../../../config/dbms/dbms_config.yml', __FILE__))))

Instance Method Summary collapse

Methods included from DbmsPluginHelper

#current_user, #get_current_user_role

Methods included from DbmsEngineHelper

#persist_connection

Instance Method Details

#configureObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/dbms_engine_controller.rb', line 19

def configure

  # Check access
  if (@curUserRole == 'contentadmin' ||
      @curUserRole == 'user' ||
      @curUserRole == 'loggedin' ||
      @curUserRole == 'anonymous')
    raise 'unauthorized access'
  end

  if request.xhr?
    if Metadata.first({ :conditions => [ 'key = ? and sites_id = ?', APP_CONFIG[:DBMS_CURRENT_DATABASE], session[:accessible_appid]] }).nil?
      raise "setup required"
    else
      if Metadata.first({ :conditions => [ 'key = ? and sites_id = ?', APP_CONFIG[:DBMS_CURRENT_DATABASE], session[:accessible_appid]] }).value.empty?
        raise "setup required"
      else
        # Perform connection persisting if necessary
        persist_connection

        respond_to do |t|
          t.html
        end
      end
    end
  else
    raise 'unauthorized access'
  end
end

#indexObject

Write your readme here



15
16
17
# File 'app/controllers/dbms_engine_controller.rb', line 15

def index

end

#installerObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/controllers/dbms_engine_controller.rb', line 49

def installer

  # Check access
  if (@curUserRole == 'contentadmin' ||
      @curUserRole == 'user' ||
      @curUserRole == 'loggedin' ||
      @curUserRole == 'anonymous')
    raise 'unauthorized access'
  end

  if request.xhr?
    respond_to do |t|
      t.html
    end
  else
    raise 'unauthorized access'
  end
end