Re: [Spacewalk-devel] [PATCH] Pam setting on the user page not saving

2011-10-13 Thread Tomas Lestach

On 10/12/2011 05:22 PM, Johannes Renner wrote:

On 10/12/2011 05:00 PM, Tomas Lestach wrote:

Hello Johannes,

yes, you're right.

I just have one comment to your patch - I'd move updatePamAttribute() in 
SelfEditAction.java file
into the updateDetails method. If you're ok with the change, I'd commit it.
Let me know.


Yes, I was just keeping things separated, but it seems as if there would be no
difference in the semantics. And you rather mean the class UserEditActionHelper,
right? You will then also need to add another parameter for the updateDetails()
method (the loggedInUser), but sure, commit it ;-)


Yes, that's what I meant. Even if not described very well. :-)
My intention was to use updateDetails() method to set the pam attribute 
as it is one of the details as well.


commited as: fbadff4927b0ca257cdd29a175507e8cbd600faf
http://git.fedorahosted.org/git/?p=spacewalk.git;a=commitdiff;h=fbadff4927b0ca257cdd29a175507e8cbd600faf

Thank you!
--
Tomas Lestach
RHN Satellite Engineering, Red Hat




Thanks,
Johannes


Regards,
--
Tomas Lestach
RHN Satellite Engineering, Red Hat


On 10/12/2011 02:28 PM, Johannes Renner wrote:

Hello,

I just fixed a bug in Spacewalk about the pam setting on the user page not 
saving,
it can be reproduced like this:

1. Configure pam on the server (e.g. echo pam_auth_service = rhn-satellite  
 /etc/rhn/rhn.conf)
2. Restart the tomcat
3. Log into spacewalk as an org_admin
4. In the page header click onusername   to edit the user's settings
5. Check on/off the use pam checkbox
6. Click on update

Result: The pam setting is not saved and the checkbox on the resulting page is
therefore shown in the same state as before.

(Note that it works to set the pam option for a user via Users -   
username)

Apply my attached patch for a fix, i.e. save the pam option using either
AdminUserEditAction.java or SelfUserEditAction.java.

Thanks,
Johannes

P.S.: I can also create a bugzilla entry if necessary, just tell me.




___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] [PATCH] Pam setting on the user page not saving

2011-10-12 Thread Johannes Renner
Hello,

I just fixed a bug in Spacewalk about the pam setting on the user page not 
saving,
it can be reproduced like this:

1. Configure pam on the server (e.g. echo pam_auth_service = rhn-satellite  
/etc/rhn/rhn.conf)
2. Restart the tomcat
3. Log into spacewalk as an org_admin
4. In the page header click on username to edit the user's settings
5. Check on/off the use pam checkbox
6. Click on update

Result: The pam setting is not saved and the checkbox on the resulting page is
therefore shown in the same state as before.

(Note that it works to set the pam option for a user via Users - username)

Apply my attached patch for a fix, i.e. save the pam option using either
AdminUserEditAction.java or SelfUserEditAction.java.

Thanks,
Johannes

P.S.: I can also create a bugzilla entry if necessary, just tell me.

-- 
SUSE LINUX Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
From 4abfbdcaea3ea3ddc5d9bb6aa1d478f2975d5723 Mon Sep 17 00:00:00 2001
From: Johannes Renner jren...@suse.de
Date: Wed, 12 Oct 2011 13:23:01 +0200
Subject: [PATCH] Fixed pam setting on user page not saving

---
 .../frontend/action/user/AdminUserEditAction.java  |   24 +--
 .../rhn/frontend/action/user/SelfEditAction.java   |3 ++
 .../frontend/action/user/UserEditActionHelper.java |   24 
 3 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/frontend/action/user/AdminUserEditAction.java b/java/code/src/com/redhat/rhn/frontend/action/user/AdminUserEditAction.java
index e34b726..fdcd29d 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/user/AdminUserEditAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/user/AdminUserEditAction.java
@@ -14,8 +14,6 @@
  */
 package com.redhat.rhn.frontend.action.user;
 
-import com.redhat.rhn.common.conf.Config;
-import com.redhat.rhn.common.conf.ConfigDefaults;
 import com.redhat.rhn.common.security.PermissionException;
 import com.redhat.rhn.domain.org.Org;
 import com.redhat.rhn.domain.role.Role;
@@ -85,26 +83,8 @@ public class AdminUserEditAction extends UserEditActionHelper {
 return returnFailure(mapping, request, errors, targetUser.getId());
 }
 
-/*
- * Update PAM Authentication attribute
- * If we're a satellite that is configured to use pam and the loggedIn user is an
- * org_admin (and therefore the checkbox was displayed), we need to inspect the
- * usepam field on the form and set the targetUser's pam auth attribute
- * accordingly. (we don't want to set this field if it wasn't displayed or if the
- * user doesn't have access to set this attribute)
- */
-String pamAuthService = Config.get().getString(ConfigDefaults.WEB_PAM_AUTH_SERVICE);
-if (pamAuthService != null 
-pamAuthService.trim().length()  0 
-loggedInUser.hasRole(RoleFactory.ORG_ADMIN)) {
-if (form.get(usepam) != null 
-((Boolean) form.get(usepam)).booleanValue()) {
-targetUser.setUsePamAuthentication(true);
-}
-else {
-targetUser.setUsePamAuthentication(false);
-}
-}
+// Update PAM Authentication attribute
+updatePamAttribute(loggedInUser, targetUser, form);
 
 //Create the user info updated success message
 createSuccessMessage(request, message.userInfoUpdated, null);
diff --git a/java/code/src/com/redhat/rhn/frontend/action/user/SelfEditAction.java b/java/code/src/com/redhat/rhn/frontend/action/user/SelfEditAction.java
index d7f8dcc..cf3201b 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/user/SelfEditAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/user/SelfEditAction.java
@@ -48,6 +48,9 @@ public class SelfEditAction extends UserEditActionHelper {
 
 //If there are no errors, store the user and return the success mapping
 if (errors.isEmpty()) {
+// Update the PAM Authentication attribute
+updatePamAttribute(user, user, form);
+
 UserManager.storeUser(user);
 
 ActionMessages msgs = new ActionMessages();
diff --git a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditActionHelper.java b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditActionHelper.java
index c61fbc6..a9c1625 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/user/UserEditActionHelper.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/user/UserEditActionHelper.java
@@ -14,6 +14,9 @@
  */
 package com.redhat.rhn.frontend.action.user;
 
+import com.redhat.rhn.common.conf.Config;
+import com.redhat.rhn.common.conf.ConfigDefaults;
+import com.redhat.rhn.domain.role.RoleFactory;
 import com.redhat.rhn.domain.user.User;
 import com.redhat.rhn.frontend.struts.RhnAction;
 import 

Re: [Spacewalk-devel] [PATCH] Pam setting on the user page not saving

2011-10-12 Thread Johannes Renner
On 10/12/2011 05:00 PM, Tomas Lestach wrote:
 Hello Johannes,
 
 yes, you're right.
 
 I just have one comment to your patch - I'd move updatePamAttribute() in 
 SelfEditAction.java file
 into the updateDetails method. If you're ok with the change, I'd commit it.
 Let me know.

Yes, I was just keeping things separated, but it seems as if there would be no
difference in the semantics. And you rather mean the class UserEditActionHelper,
right? You will then also need to add another parameter for the updateDetails()
method (the loggedInUser), but sure, commit it ;-)

Thanks,
Johannes

 Regards,
 -- 
 Tomas Lestach
 RHN Satellite Engineering, Red Hat
 
 
 On 10/12/2011 02:28 PM, Johannes Renner wrote:
 Hello,

 I just fixed a bug in Spacewalk about the pam setting on the user page not 
 saving,
 it can be reproduced like this:

 1. Configure pam on the server (e.g. echo pam_auth_service = 
 rhn-satellite  /etc/rhn/rhn.conf)
 2. Restart the tomcat
 3. Log into spacewalk as an org_admin
 4. In the page header click onusername  to edit the user's settings
 5. Check on/off the use pam checkbox
 6. Click on update

 Result: The pam setting is not saved and the checkbox on the resulting page 
 is
 therefore shown in the same state as before.

 (Note that it works to set the pam option for a user via Users -  
 username)

 Apply my attached patch for a fix, i.e. save the pam option using either
 AdminUserEditAction.java or SelfUserEditAction.java.

 Thanks,
 Johannes

 P.S.: I can also create a bugzilla entry if necessary, just tell me.




 ___
 Spacewalk-devel mailing list
 Spacewalk-devel@redhat.com
 https://www.redhat.com/mailman/listinfo/spacewalk-devel
 
 ___
 Spacewalk-devel mailing list
 Spacewalk-devel@redhat.com
 https://www.redhat.com/mailman/listinfo/spacewalk-devel

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel