Class: CantangoEditor::PermissionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/cantango_editor/permissions_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/cantango_editor/permissions_controller.rb', line 6

def index
  @actions = Permissions.actions_available     
  @models = Permissions.models_available
  @permission_types = Permissions.permission_types_available
  @permission_groups = Permissions.permission_groups_available
  @permissions = Permissions.yml_file_content

  respond_to do |format|
    format.html 
    format.js { render 'index.js.erb' }
  end
end

#new_categoryObject



39
40
41
# File 'app/controllers/cantango_editor/permissions_controller.rb', line 39

def new_category
  @new_categories_available = Categories.available_except(params[:existing_targets].to_a)
end

#new_custom_targetObject



32
33
# File 'app/controllers/cantango_editor/permissions_controller.rb', line 32

def new_custom_target
end

#new_targetObject



35
36
37
# File 'app/controllers/cantango_editor/permissions_controller.rb', line 35

def new_target
  @new_targets_available = Permissions.models_available_names - params[:existing_targets].to_a
end

#preview_rawObject



43
44
45
# File 'app/controllers/cantango_editor/permissions_controller.rb', line 43

def preview_raw
  @permissions_content = Permissions.raw_file_content
end

#process_paramsObject



26
27
28
29
30
# File 'app/controllers/cantango_editor/permissions_controller.rb', line 26

def process_params
  [:ptype, :pgroup, :can_action, :crud_action].each do |param|
    instance_variable_set("@#{param}", params[param])
  end
end

#updateObject



19
20
21
22
23
# File 'app/controllers/cantango_editor/permissions_controller.rb', line 19

def update 
  Permissions.update_permissions! params
  
  index
end