Sha256: a2a692e4814089725e721e4abfc7529891fd204be8c8b6181b6d863a9e9d3b34

Contents?: true

Size: 661 Bytes

Versions: 3

Compression:

Stored size: 661 Bytes

Contents

class Admin::UsersController < Admin::ResourceController
  only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, :destroy,
    :when => :admin,
    :denied_url => { :controller => 'pages', :action => 'index' },
    :denied_message => 'You must have administrative privileges to perform this action.'

  before_filter :ensure_deletable, :only => [:remove, :destroy]
  
  def ensure_deletable
    if current_user.id.to_s == params[:id].to_s
      announce_cannot_delete_self
      redirect_to admin_users_url
    end
  end
  
  private
  
    def announce_cannot_delete_self
      flash[:error] = 'You cannot delete yourself.'
    end  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-0.7.2 app/controllers/admin/users_controller.rb
radiant-0.7.0 app/controllers/admin/users_controller.rb
radiant-0.7.1 app/controllers/admin/users_controller.rb