Module: Lockdown::ControllerInspector::Core
Instance Method Summary collapse
-
#all_controllers ⇒ Object
all controllers, all actions.
-
#all_except_methods(sym, *methods) ⇒ Object
controller name (sym) and a splat of methods to exclude from result.
-
#all_methods(*syms) ⇒ Object
*syms is a splat of controller symbols, e.g all_methods(:users, :authors, :books).
-
#only_methods(sym, *methods) ⇒ Object
controller name (sym) and a splat of methods to to build the result.
Methods included from Helper
#administrator_group_string, #administrator_group_symbol, #camelize, #convert_reference_name, #random_string, #string_name, #symbol_name, #symbolize, #syms_from_names
Instance Method Details
#all_controllers ⇒ Object
all controllers, all actions
This is admin access
48 49 50 51 52 53 54 55 |
# File 'lib/lockdown/controller_inspector.rb', line 48 def all_controllers controllers = find_all_controller_classes controllers.collect do |controller| methods = available_actions(controller) paths_for(controller_name(controller), methods) end.flatten! end |
#all_except_methods(sym, *methods) ⇒ Object
controller name (sym) and a splat of methods to exclude from result
All user methods except destroy: e.g all_except_methods(:users, :destroy)
28 29 30 |
# File 'lib/lockdown/controller_inspector.rb', line 28 def all_except_methods(sym, *methods) paths_for(sym) - paths_for(sym, *methods) end |
#all_methods(*syms) ⇒ Object
*syms is a splat of controller symbols, e.g all_methods(:users, :authors, :books)
17 18 19 |
# File 'lib/lockdown/controller_inspector.rb', line 17 def all_methods(*syms) syms.collect{ |sym| paths_for(sym) }.flatten end |
#only_methods(sym, *methods) ⇒ Object
controller name (sym) and a splat of methods to to build the result
Only user methods index (list), show (good for readonly access): e.g only_methods(:users, :index, :show)
39 40 41 |
# File 'lib/lockdown/controller_inspector.rb', line 39 def only_methods(sym, *methods) paths_for(sym, *methods) end |