This patch stopped current user from being displayed in the manage users list. Since this is a special user (currently logged in). If an admin user wants to edit him/herself they can do so they same way all other users update their own profiles.
From: martyntaylor mtaylor@redhat.com
--- src/app/controllers/users_controller.rb | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb index 7047517..c594844 100644 --- a/src/app/controllers/users_controller.rb +++ b/src/app/controllers/users_controller.rb @@ -103,15 +103,16 @@ class UsersController < ApplicationController def index if @current_user.permissions.collect { |p| p.role }.find { |r| r.name == "Administrator" } @users = User.all + @users.delete(@current_user) + sort_order = params[:sort_by].nil? ? "login" : params[:sort_by] if sort_order == "percentage_quota_used" - @users = User.all @users.sort! {|x,y| y.quota.percentage_used <=> x.quota.percentage_used } elsif sort_order == "quota" - @users = User.all @users.sort! {|x,y| (x.quota.maximum_running_instances and y.quota.maximum_running_instances) ? x.quota.maximum_running_instances <=> y.quota.maximum_running_instances : (x ? 1 : -1) } else @users = User.find(:all, :order => sort_order) + @users.delete(@current_user) end else flash[:notice] = "Invalid Permission to perform this operation" @@ -140,7 +141,9 @@ class UsersController < ApplicationController if @current_user.permissions.collect { |p| p.role }.find { |r| r.name == "Administrator" } if request.post? || request.delete? @user = User.find(params[:id]) - if @user.destroy + if @user == @current_user + flash[:notice] = "Can not delete currently logged in user" + elsif @user.destroy flash[:notice] = "User Deleted" else flash[:error] = {
mtaylor@redhat.com wrote:
From: martyntaylor mtaylor@redhat.com
src/app/controllers/users_controller.rb | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
NACK this one -- the later one is better.
Scott
deltacloud-devel@lists.fedorahosted.org