Sha256: 9e0b1ff09a296a43541277d3e850b6980f6ca6cee64ad564af32b960d17607c5

Contents?: true

Size: 1003 Bytes

Versions: 7

Compression:

Stored size: 1003 Bytes

Contents

class Admin::RoleSectionController < ApplicationController
  # before_filter :login_required
  before_filter :find_role, :only=>[:destroy, :delete_policy]
  
  def destroy
    section_name = params[:id]
    role = TheRole.get(@role.the_role)
    role.delete(section_name.to_sym)

    if @role.update_attributes({:the_role => role.to_yaml})
      flash[:notice] = t('the_role.section_deleted')
      redirect_to edit_admin_role_path(@role)
    else
      render :action => :edit
    end   
  end#destroy
  
  def delete_policy
    section_name = params[:id]
    policy_name = params[:name]
    role = TheRole.get(@role.the_role)
    role[section_name.to_sym].delete(policy_name.to_sym)
    
    if @role.update_attributes({:the_role => role.to_yaml})
      flash[:notice] = t('the_role.section_policy_deleted')
      redirect_to edit_admin_role_path(@role)
    else
      render :action => :edit
    end
  end#delete_policy

  protected

  def find_role
    @role = Role.find(params[:role_id])
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
the_role-1.1.1 app/controllers/admin/role_section_controller.rb
the_role-1.1.0 app/controllers/admin/role_section_controller.rb
the_role-1.0.0 app/controllers/admin/role_section_controller.rb
the_role-0.9.93 app/controllers/admin/role_section_controller.rb
the_role-0.9.92 app/controllers/admin/role_section_controller.rb
the_role-0.9.91 app/controllers/admin/role_section_controller.rb
the_role-0.9.9 app/controllers/admin/role_section_controller.rb