Sha256: 6f6392e502f760180d017cd5324c9eaac33d2dcf1eba840e332c946759619ae9

Contents?: true

Size: 1.08 KB

Versions: 528

Compression:

Stored size: 1.08 KB

Contents

module Caboose
  class PagePermissionsController < ApplicationController
    
    # POST /admin/page-permissions
    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

    # DELETE /admin/page-permissions
    # DELETE /admin/page-permissions/:id
    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
		
  end
end

Version data entries

528 entries across 528 versions & 1 rubygems

Version Path
caboose-cms-0.7.85 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.84 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.83 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.82 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.81 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.80 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.79 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.78 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.77 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.76 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.75 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.74 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.73 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.72 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.71 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.70 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.69 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.68 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.67 app/controllers/caboose/page_permissions_controller.rb
caboose-cms-0.7.66 app/controllers/caboose/page_permissions_controller.rb