Sha256: 572a0676cdb2cfe338fd527d63546343634fd1e54113586b05268a3ae6ec8f8b

Contents?: true

Size: 1.76 KB

Versions: 97

Compression:

Stored size: 1.76 KB

Contents

module Goldberg
  class RolesPermissionsController < 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
      @roles_permissions = RolesPermission.find(:all)
    end

    def show
      @roles_permission = RolesPermission.find(params[:id])
    end

    def new
      @roles_permission = RolesPermission.new
    end

    def new_permission_for_role
      @roles_permission = RolesPermission.new
      @roles_permission.role_id = params[:id]
      @role = Role.find(params[:id])
      @permissions = Permission.find_not_for_role(params[:id])
    end

    def create
      @roles_permission = RolesPermission.new(params[:roles_permission])
      if @roles_permission.save
        flash[:notice] = 'RolesPermission was successfully created.'
        redirect_to :controller => 'roles', :action => 'show', 
        :id => @roles_permission.role_id
      else
        render :action => 'new'
      end
    end

    def edit
      @roles_permission = RolesPermission.find(params[:id])
    end

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

    def destroy
      rp = RolesPermission.find(params[:id])
      role = rp.role_id
      rp.destroy
      redirect_to :controller => 'roles', :action => 'show', :id => role
    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/roles_permissions_controller.rb
six-updater-web-0.24.14 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.13 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.12 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.11 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.10 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.9 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.8 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.7 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.6 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.5 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.4 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.3 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.2 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.1 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.24.0 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.23.7 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.23.6 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.23.5 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.23.4 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb