Sha256: 5a7271c958dc9bb6b8651a9923077f04e6ef0fba55486fa50668d6c43776f9d7

Contents?: true

Size: 1.5 KB

Versions: 97

Compression:

Stored size: 1.5 KB

Contents

module Goldberg
  class PermissionsController < ApplicationController
    include Goldberg::Controller

    # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
    verify :method => :post, :only => [ :destroy, :create, :update ],
    :redirect_to => { :action => :list }

    def index
      list
      render :action => 'list'
    end

    def list
      @permissions = Permission.find(:all, :order => 'name')
    end

    def show
      @permission = Permission.find(params[:id])
      @pages = ContentPage.find_for_permission(params[:id])
      @actions = ControllerAction.find_for_permission(params[:id])
    end

    def new
      @permission = Permission.new
    end

    def create
      @permission = Permission.new(params[:permission])
      if @permission.save
        flash[:notice] = 'Permission was successfully created.'
        Role.rebuild_cache
        redirect_to :action => 'list'
      else
        render :action => 'new'
      end
    end

    def edit
      @permission = Permission.find(params[:id])
    end

    def update
      @permission = Permission.find(params[:id])
      if @permission.update_attributes(params[:permission])
        flash[:notice] = 'Permission was successfully updated.'
        Role.rebuild_cache
        redirect_to :action => 'show', :id => @permission
      else
        render :action => 'edit'
      end
    end

    def destroy
      Permission.find(params[:id]).destroy
      Role.rebuild_cache
      redirect_to :action => 'list'
    end
  end
end

Version data entries

97 entries across 97 versions & 2 rubygems

Version Path
six-updater-web-0.24.15 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.14 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.13 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.12 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.11 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.10 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.9 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.8 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.7 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.6 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.5 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.4 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.3 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.2 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.1 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.24.0 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.23.7 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.23.6 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.23.5 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb
six-updater-web-0.23.4 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb