Sha256: 71b96d47679c12e1d4b0b7e5a82ebed071884e4aa109942bd4fb9dcbe075a8f4

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

class UsersController < ApplicationController
  verify :method => :post, :only => [:update],
         :redirect_to => {:action => :index}

  before_filter :login_required

  def index
    @users = find(:all)
  end

  def show
    @user = find(params[:id])
  end

  def edit
    @user = find(params[:id])
  end

  def update
    @user = find(params[:id])
    previous_user_password = @user.user_password
    if @user.update_attributes(params[:user])
      if previous_user_password != @user.user_password
        @user.establish_connection(:password => @user.password)
      end
      flash[:notice] = _('User was successfully updated.')
      redirect_to :action => 'show', :id => @user
    else
      @user.password = @user.password_confirmation = nil
      render :action => 'edit'
    end
  end

  private
  def find(*args)
    current_user.ldap_user.find(*args)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-activeldap-0.8.3.1 examples/al-admin/app/controllers/users_controller.rb