Sha256: 59d9b486378afc5495d3d99da99fc45867d71c67c5cbce7ac33b59b6426df255

Contents?: true

Size: 1.24 KB

Versions: 34

Compression:

Stored size: 1.24 KB

Contents

class Admin::Muck::RolesController < Admin::Muck::BaseController
  unloadable
  
  def index
    @user = User.find(params[:user_id])
    @all_roles = Role.find(:all)
  end

  def show
    @role = Role.new(params[:role])
  end

  def new
    @role = Role.new(params[:role])
  end

  # POST /websites
  # POST /websites.xml
  def create
    @role = Role.new(params[:role])

    respond_to do |format|
      if @role.save
        flash[:notice] = I18n.t('muck.roles.role_created')
        format.html { redirect_to(admin_roles_path(@role)) }
        format.xml  { render :xml => @role, :status => :created, :location => @role }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @role.errors, :status => :unprocessable_entity }
      end
    end
  end

  def edit
    @role = Role.new(params[:role])
  end

  def update
    @user = User.find(params[:user_id])
    @role = Role.find(params[:id])
    unless @user.has_role?(@role.rolename)
      @user.roles << @role
    end
    redirect_to :action => 'index'
  end

  def destroy
    @user = User.find(params[:user_id])
    @role = Role.find(params[:id])
    if @user.has_role?(@role.rolename)
      @user.roles.delete(@role)
    end
    redirect_to :action => 'index'
  end

end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
muck-users-0.2.19 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.18 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.17 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.16 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.15 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.14 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.13 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.12 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.11 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.10 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.9 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.6 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.7 app/controllers/admin/muck/roles_controller.rb
muck-users-0.2.8 app/controllers/admin/muck/roles_controller.rb
muck-users-0.1.4 app/controllers/admin/muck/roles_controller.rb
muck-users-0.1.5 app/controllers/admin/muck/roles_controller.rb
muck-users-0.1.6 app/controllers/admin/muck/roles_controller.rb
muck-users-0.1.7 app/controllers/admin/muck/roles_controller.rb
muck-users-0.1.8 app/controllers/admin/muck/roles_controller.rb
muck-users-0.1.9 app/controllers/admin/muck/roles_controller.rb