Changeset 245

Show
Ignore:
Timestamp:
03/01/06 21:10:43
Author:
douglm
Message:

Fix admin group add/update problem. Also prevent duplicate groups

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AdminGroupsDbImpl.java

    r2 r245  
    173173 
    174174  public void addGroup(BwGroup group) throws CalFacadeException { 
     175    if (findGroup(group.getAccount()) != null) { 
     176      throw new CalFacadeException(CalFacadeException.duplicateAdminGroup); 
     177    } 
    175178    getSess().save(group); 
    176179  } 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeException.java

    r99 r245  
    5959 */ 
    6060public class CalFacadeException extends Exception { 
    61   /** Property names used as message value. These should be used to 
     61  /* Property names used as message value. These should be used to 
    6262   * retrieve a localized message and can also be used to identify the 
    6363   * cause of the exception. 
    6464   */ 
     65   
     66  /* ****************** Admin groups ****************************** */ 
     67   
     68  /** The admin group already exists */ 
     69  public static final String duplicateAdminGroup = 
     70      "org.bedework.exception.duplicateadmingroup"; 
    6571 
     72  /* ****************** Calendars ****************************** */ 
     73   
    6674  /** Couldn't find calendar */ 
    6775  public static final String calendarNotFound = 
     
    8492      "org.bedework.exception.cannotdeletecalendarroot"; 
    8593 
     94  /* ****************** Subscriptions ****************************** */ 
     95   
    8696  /** Somebody tried to create a duplicate subscription */ 
    8797  public static final String duplicateSubscription = 
     
    92102      "org.bedework.exception.ical.endandduration"; 
    93103 
    94   /** */ 
    95   public static final String illegalObjectClass = 
    96       "org.bedework.exception.illegalobjectclass"; 
    97  
     104  /* ****************** Events ****************************** */ 
     105   
    98106  /** The guid for this event already exists */ 
    99107  public static final String duplicateGuid = 
    100108      "org.bedework.exception.duplicateguid"; 
    101109 
     110  /* ****************** Timezones ****************************** */ 
     111   
    102112  /** Error reading timezones */ 
    103113  public static final String timezonesReadError = 
    104114      "org.bedework.error.timezones.readerror"; 
    105115 
     116  /* ****************** Misc ****************************** */ 
    106117 
     118  /** */ 
     119  public static final String illegalObjectClass = 
     120      "org.bedework.exception.illegalobjectclass"; 
     121   
    107122  private String extra; 
    108123 
  • trunk/calendar3/webadmin/src/org/bedework/webadmin/admingroup/PEFetchAGAction.java

    r55 r245  
    114114    adgrps.getMembers(ag); 
    115115    form.setUpdAdminGroup(ag); 
     116    form.assignAddingAdmingroup(false); 
    116117 
    117118    return "continue"; 
  • trunk/calendar3/webadmin/src/org/bedework/webadmin/admingroup/PEUpdateAGAction.java

    r165 r245  
    5656 
    5757import org.bedework.calfacade.BwUser; 
     58import org.bedework.calfacade.CalFacadeException; 
    5859import org.bedework.calfacade.ifs.Groups; 
    5960import org.bedework.calfacade.svc.BwAdminGroup; 
     
    162163      } 
    163164 
    164       adgrps.addGroup(updgrp); 
     165      try { 
     166        adgrps.addGroup(updgrp); 
     167      } catch (CalFacadeException cfe) { 
     168        if (CalFacadeException.duplicateAdminGroup.equals(cfe.getMessage())) { 
     169          form.getErr().emit("org.bedework.error.duplicate.admingroup",  
     170                             updgrp.getAccount()); 
     171          return "retry"; 
     172        } else { 
     173          throw cfe; 
     174        } 
     175      } 
     176       
     177      form.assignAddingAdmingroup(false); 
    165178    } else { 
    166179      if (!validateAdminGroup(form)) {