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.14.1 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.13.6 lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.13.5 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.13.4 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.13.3 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.13.2 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.13.1 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.12.7 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.12.6 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.12.5 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.12.4 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.12.3 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.12.2 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.12.1 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.11.2 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
six-updater-web-0.11.1 lib/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb
goldberg_generator-0.2.2 templates/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb