Class: Authengine::ActionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/authengine/actions_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
# File 'app/controllers/authengine/actions_controller.rb', line 4

def index
  Controller.update_table # make sure the actions table includes all current controllers/actions
  @actions = Action.all(:include=>:controller).sort
  @roles = Role.all(:include=>{:actions=>:controller}, :order=>:name) # this eager loading seems to produce a large number of database accesses, and I'm not sure why!!
  @allowed = []
  @roles.each{ |r| @allowed[r.id]= r.name=="developer" ? @actions.map(&:id) : r.actions.map{ |a| a.id unless a.nil? } }
end

#updateObject



12
13
14
15
# File 'app/controllers/authengine/actions_controller.rb', line 12

def update
  ActionRole.update_all(params)
  redirect_to (authengine_actions_url)
end