Changeset 7778

Show
Ignore:
Timestamp:
07/10/09 15:56:46 (13 months ago)
Author:
dragisak
Message:

Fix bug introduced by r6940

Administrators would end up modifying their own preferences instead of selected user's.

Addresses #1349

Location:
head/ambra/webapp/src/main/java/org/topazproject/ambra/user/action
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • head/ambra/webapp/src/main/java/org/topazproject/ambra/user/action/AdminUserAlertsAction.java

    r6940 r7778  
    22 * $Id$ 
    33 * 
    4  * Copyright (c) 2006-2008 by Topaz, Inc. 
     4 * Copyright (c) 2006-2009 by Topaz, Inc. 
    55 * http://topazproject.org 
    66 * 
     
    4545  } 
    4646 
    47   /** Using by freemarker to indicate that the user profile is being edited by an admin */ 
     47  /** 
     48   * Using by freemarker to indicate that the user profile is being edited by an admin 
     49   * @return true 
     50   */ 
    4851  public boolean getIsEditedByAdmin() { 
    4952    return true; 
    5053  } 
     54 
     55  /** 
     56   * Get user being modified by administrator 
     57   * @return AmbraUser object of the user specified in topazId   
     58   * @throws ApplicationException 
     59   */ 
     60  @Override 
     61  protected AmbraUser getAmbraUserToUse() throws ApplicationException { 
     62    return getUserService().getUserByTopazId(topazId); 
     63  } 
    5164} 
  • head/ambra/webapp/src/main/java/org/topazproject/ambra/user/action/MemberUserAlertsAction.java

    r6940 r7778  
    22 * $Id$ 
    33 * 
    4  * Copyright (c) 2006-2008 by Topaz, Inc. 
     4 * Copyright (c) 2006-2009 by Topaz, Inc. 
    55 * http://topazproject.org 
    66 * 
     
    2626 */ 
    2727public class MemberUserAlertsAction extends UserAlertsAction { 
     28 
     29  /** 
     30   * Get logged in user 
     31   * @return currently logged in user object 
     32   */ 
     33  @Override 
     34  protected AmbraUser getAmbraUserToUse() { 
     35    return getCurrentUser(); 
     36  } 
    2837} 
  • head/ambra/webapp/src/main/java/org/topazproject/ambra/user/action/UserAlertsAction.java

    r7197 r7778  
    22 * $Id$ 
    33 * 
    4  * Copyright (c) 2006-2008 by Topaz, Inc. 
     4 * Copyright (c) 2006-2009 by Topaz, Inc. 
    55 * http://topazproject.org 
    66 * 
     
    3737import org.topazproject.ambra.user.AmbraUser; 
    3838import org.topazproject.ambra.user.service.UserAlert; 
     39import org.topazproject.ambra.ApplicationException; 
    3940 
    4041/** 
     
    119120  @Transactional(rollbackFor = { Throwable.class }) 
    120121  public String saveAlerts() throws Exception { 
    121     final AmbraUser ambraUser = getCurrentUser(); 
     122    final AmbraUser ambraUser = getAmbraUserToUse(); 
    122123    if (ambraUser == null) { 
    123124      throw new ServletException("Unable to resolve ambra user"); 
     
    153154  @Transactional(readOnly = true) 
    154155  public String retrieveAlerts() throws Exception { 
    155     final AmbraUser ambraUser = getCurrentUser(); 
     156    final AmbraUser ambraUser = getAmbraUserToUse(); 
    156157    if (ambraUser == null) { 
    157158      throw new ServletException("Unable to resolve ambra user"); 
     
    226227    this.displayName = displayName; 
    227228  } 
     229 
     230  /** 
     231   * Provides a way to get the AmbraUser to edit 
     232   * @return the AmbraUser to edit 
     233   * @throws org.topazproject.ambra.ApplicationException ApplicationException 
     234   */ 
     235  protected abstract AmbraUser getAmbraUserToUse() throws ApplicationException; 
     236 
    228237}