Class: AccessControlEntriesController

Inherits:
InheritedResources::Base
  • Object
show all
Defined in:
app/controllers/access_control_entries_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
# File 'app/controllers/access_control_entries_controller.rb', line 9

def create
  parent = params.slice(:sitemap_id, :page_id, :forum_id, :user_id, :role_id).
                  to_a[0]
  parent = parent[0].gsub(/_id/, '').camelize.constantize.find(parent[1]) if parent
  @access_control_entry = parent.access_control_entries.create(params[:access_control_entry])
  respond_with @access_control_entry
end

#new_aceObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/access_control_entries_controller.rb', line 17

def new_ace
  a = AccessControlEntry.new
  a.user_id = params[:user_id]
  a.role_id = params[:role_id]
  a.resource_type = case true
    when params.include?(:sitemap_id) then "Sitemap"
    when params.include?(:page_id) then "Page"
    when params.include?(:forum_id) then "Forum"
    else nil
  end
  return a
end

#sortObject



30
31
32
33
34
35
# File 'app/controllers/access_control_entries_controller.rb', line 30

def sort
  order = params[:ids]
  parent.access_control_entries.
  Image.order(order)
  render :text => order.inspect
end