new ui member account privilege fix

This commit is contained in:
Spen 2013-10-18 19:02:14 +08:00 committed by saurabhbhatia
parent f9f2232259
commit c76adc1896
4 changed files with 16 additions and 2 deletions

View File

@ -275,6 +275,18 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
render :action => :setting_account, :notice => flash.now[:error]
end
elsif params[:edit_type] == 'edit_privilege'
if @user.admin && current_user.id == @user.id
flash.now[:error] = t("users.admin_change_password")
end
if !flash.now[:error] && @user.update_attributes(params[:user])
redirect_to :action => :show
else
render :action => :edit_privilege, :notice => flash.now[:error]
end
else
@user.update_attributes(params[:user])

View File

@ -20,8 +20,8 @@
<small class="muted"><%= @user.email %></small>
<div class="btn-group">
<%= link_to("<i class='icon-edit'></i> #{t(:edit)}".html_safe,edit_admin_users_new_interface_path(@user),:class=>"btn btn-mini" ) if is_admin?%>
<%= link_to("<i class='icons-cycle'></i> #{t("users.change_passwd")}".html_safe,admin_users_new_interface_edit_passwd_path(@user),:class=>"btn btn-mini" ) if is_admin? and current_user.id != @user.id %>
<%= link_to("<i class='icons-lock-open'></i> #{t("users.setting_privilege")}".html_safe,admin_users_new_interface_edit_privilege_path(@user),:class=>"btn btn-mini" ) if is_admin? and current_user.id != @user.id %>
</div>
</div>

View File

@ -486,7 +486,8 @@ en:
users:
admin_change_password: You cannot change your own password here!
avatar: Profile Picture
change_passwd: Change Password
change_passwd: Password
setting_privilege: Privilege
email: Email
first_name: First Name
last_name: Last Name

View File

@ -221,6 +221,7 @@ Orbit::Application.routes.draw do
match "edit_passwd" => "users_new_interface#edit_passwd" ,:as => :edit_passwd
match "edit_user_data" => "users_new_interface#edit_user_data" ,:as => :edit_user_data
match "setting_account" => "users_new_interface#setting_account" ,:as => :setting_account
match "edit_privilege" => "users_new_interface#edit_privilege" ,:as => :edit_privilege
end
resources :member_selects do