Class: Caboose::PagePermissionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Caboose::PagePermissionsController
- Defined in:
- app/controllers/caboose/page_permissions_controller.rb
Instance Method Summary collapse
-
#admin_add ⇒ Object
POST /admin/page-permissions.
-
#admin_delete ⇒ Object
DELETE /admin/page-permissions DELETE /admin/page-permissions/:id.
Methods inherited from ApplicationController
#add_ga_event, #admin_bulk_add, #admin_bulk_delete, #admin_bulk_update, #admin_edit, #admin_index, #admin_json, #admin_json_single, #admin_update, #before_action, #before_before_action, #hashify_query_string, #init_cart, #logged_in?, #logged_in_user, #login_user, #logout_user, #parse_url_params, #reject_param, #under_construction_or_forwarding_domain?, #user_is_allowed, #user_is_allowed_to, #validate_cookie, #validate_token, #var, #verify_logged_in
Instance Method Details
#admin_add ⇒ Object
POST /admin/page-permissions
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/caboose/page_permissions_controller.rb', line 6 def admin_add return unless user_is_allowed('pages', 'add') resp = Caboose::StdClass.new page_id = params[:page_id] role_id = params[:role_id] action = params[:action2] if !PagePermission.where(:page_id => page_id, :role_id => role_id, :action => action).exists? PagePermission.create(:page_id => page_id, :role_id => role_id, :action => action) end resp.success = true render :json => resp end |
#admin_delete ⇒ Object
DELETE /admin/page-permissions DELETE /admin/page-permissions/:id
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/caboose/page_permissions_controller.rb', line 24 def admin_delete return unless user_is_allowed('pages', 'edit') if params[:id] PagePermission.find(params[:id]).destroy else PagePermission.where(:page_id => params[:page_id], :role_id => params[:role_id], :action => params[:action2]).destroy_all end resp = StdClass.new('success' => true) render :json => true end |