[PATCH] BZ859998 disable certain fields from editing if in ldap mode

tzumainn at redhat.com tzumainn at redhat.com
Fri Sep 28 19:49:44 UTC 2012


From: Tzu-Mainn Chen <tzumainn at redhat.com>

---
 src/app/controllers/users_controller.rb |    1 +
 src/app/views/users/_form.html.haml     |   12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index d26028d..4a2868f 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -97,6 +97,7 @@ class UsersController < ApplicationController
     @user = params[:id] ? User.find(params[:id]) : current_user
     require_privilege(Privilege::MODIFY, User) unless @user == current_user
     @title = t'users.edit.edit_user'
+    @ldap_user = (SETTINGS_CONFIG[:auth][:strategy] == "ldap")
   end
 
   def update
diff --git a/src/app/views/users/_form.html.haml b/src/app/views/users/_form.html.haml
index 859d920..abbb89a 100644
--- a/src/app/views/users/_form.html.haml
+++ b/src/app/views/users/_form.html.haml
@@ -5,28 +5,28 @@
   .field
     = form.label :first_name
     .input
-      = form.text_field :first_name, :class =>"check_change"
+      = form.text_field :first_name, :class =>"check_change", :disabled => @ldap_user
   .field
     = form.label :last_name
     .input
-      = form.text_field :last_name, :class =>"check_change"
+      = form.text_field :last_name, :class =>"check_change", :disabled => @ldap_user
   .field
     = form.label :email, t(:email), :required => true
     .input
-      = form.text_field :email, :class =>"check_change"
+      = form.text_field :email, :class =>"check_change", :disabled => @ldap_user
 %fieldset
   .field
     = form.label :username, t(:choose_name), :required => true
     .input
-      = form.text_field :username, :class => "check_change"
+      = form.text_field :username, :class => "check_change", :disabled => @ldap_user
   .field
     = form.label :password, form.object.new_record? ? t(:choose_password) : t(:change_password), :required => form.object.new_record?
     .input
-      = form.password_field :password
+      = form.password_field :password, :disabled => @ldap_user
   .field
     = form.label :password_confirmation, t(:confirm_password), :required => form.object.new_record?
     .input
-      = form.password_field :password_confirmation
+      = form.password_field :password_confirmation, :disabled => @ldap_user
 
 - if check_privilege(Privilege::MODIFY, User)
   %fieldset
-- 
1.7.6.5




More information about the aeolus-devel mailing list