Sha256: da36d8da0595e0df0834c69b3a02870426554c9cd8cf2d93cb9839728b842ab0

Contents?: true

Size: 796 Bytes

Versions: 10

Compression:

Stored size: 796 Bytes

Contents

class Cbac::MembershipsController < ApplicationController
  # The layout used for all CBAC pages
  layout "cbac"

  # GET /index
  # GET /index.xml
  def index
    @generic_roles = Cbac::GenericRole.find(:all)
    @users = User.find(:all)
  end

  # POST /update
  def update
    Cbac::Membership.find(:all, :conditions => ["generic_role_id = ? AND user_id = ?", params[:generic_role_id], params[:user_id]]).each{|p|p.delete}
    if params[:member].to_s == "1"
      Cbac::Membership.create(:generic_role_id => params[:generic_role_id], :user_id => params[:user_id])
    end
    role = Cbac::GenericRole.find(params[:generic_role_id])
    render :partial => "cbac/memberships/update.html", :locals => {:generic_role => role,
      :user_id => params[:user_id], :update_partial => true}
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cbac-0.6.8 lib/generators/cbac/copy_files/controllers/memberships_controller.rb
cbac-0.6.7 lib/generators/cbac/copy_files/controllers/memberships_controller.rb
cbac-0.6.5 lib/generators/cbac/copy_files/controllers/memberships_controller.rb
cbac-0.6.4 lib/generators/cbac/copy_files/controllers/memberships_controller.rb
cbac-0.6.2 lib/generators/cbac/copy_files/controllers/memberships_controller.rb
cbac-0.5.4 generators/cbac/templates/controllers/memberships_controller.rb
cbac-0.5.3 generators/cbac/templates/controllers/memberships_controller.rb
cbac-0.5.2 generators/cbac/templates/controllers/memberships_controller.rb
cbac-0.5.1 generators/cbac/templates/controllers/memberships_controller.rb
cbac-0.3.1 generators/cbac/templates/controllers/memberships_controller.rb