diff --git a/app/controllers/admin/users_new_interface_controller.rb b/app/controllers/admin/users_new_interface_controller.rb index 188cc24b5..77045ed34 100644 --- a/app/controllers/admin/users_new_interface_controller.rb +++ b/app/controllers/admin/users_new_interface_controller.rb @@ -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]) diff --git a/app/views/admin/users_new_interface/show.html.erb b/app/views/admin/users_new_interface/show.html.erb index a57752de5..a87e4ee2d 100644 --- a/app/views/admin/users_new_interface/show.html.erb +++ b/app/views/admin/users_new_interface/show.html.erb @@ -20,8 +20,8 @@ <%= @user.email %>
<%= link_to(" #{t(:edit)}".html_safe,edit_admin_users_new_interface_path(@user),:class=>"btn btn-mini" ) if is_admin?%> - <%= link_to(" #{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(" #{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 %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 00b5e38c9..9ddf81f5a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 0e060d34e..6c71cf70f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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