admin status change

This commit is contained in:
chris authored and ihower committed 2011-04-13 18:22:50 +08:00
1 parent e360baadde
commit 4b4cdbfd31
7 files changed
+17 -3

No files matched your search

+4 -1
View File
@@ -43,7 +43,10 @@ class Panel::UsersController < ApplicationController
@user.remove_avatar! if params[:file]
@user.avatar = params[:file] if params[:file]
if @user.update_attributes(params[:user])
if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b
flash.now[:error] = t('panel.cant_revoke_self_admin')
end
if !flash[:error] && @user.update_attributes(params[:user])
flash[:notice] = t('panel.update_success_user')
redirect_to :action => :index
else