Changeset 675


Ignore:
Timestamp:
02/24/10 16:35:19 (7 months ago)
Author:
fabman
Message:

more pub user fixes for freshly-created repos

Location:
trunk/src/com/calenco
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/calenco/CalencoV2.java

    r667 r675  
    6767    private static final Logger log = Logger.getLogger(CalencoV2.class); 
    6868 
    69     private static SUSecurityManager suSecMgr = SUSecurityManager.getInstance(); 
    70  
    7169    public CalencoV2() throws Exception { 
    7270        initRepo(); 
     71        SUSecurityManager.getInstance(); 
    7372    } 
    7473 
     
    201200 
    202201    /** 
    203      * Store some files on the content root, and basic users and groups 
     202     * Store system resources 
    204203     * 
    205204     * @param session the <code>javax.jcr.Session</code> used for item storage 
     
    217216            admin = udao.addOrUpdate(admin); 
    218217        } 
    219         // Create, or update, publication user 
    220         User pubuser = new User(); 
    221         pubuser.setEmail(User.PUB_USER_EMAIL); // NOI18N 
    222         pubuser.setName("Special User Running Publications"); // NOI18N 
    223         pubuser.setPassword(suSecMgr.getPubPass()); 
    224         pubuser = udao.addOrUpdate(pubuser); 
    225218    } 
    226219 
  • trunk/src/com/calenco/security/SUSecurityManager.java

    r674 r675  
    6363                isAdminPassSet = false; 
    6464            } 
    65             /* Generate and store the password for the pub user */ 
     65            // Create, or update, publication user 
     66            User pubuser = new User(); 
     67            pubuser.setEmail(User.PUB_USER_EMAIL); 
     68            pubuser.setName("Special User Running Publications"); // NOI18N 
    6669            SecureRandom rng = new SecureRandom(); 
    6770            byte[] passBytes = new byte[20]; 
    6871            rng.nextBytes(passBytes); 
    6972            pubPass = new String(passBytes); 
    70             UserDAO udao = new UserDAO(session); 
    71             User pubUser = udao.findByName(User.PUB_USER_EMAIL); 
    72             pubUser.setPassword(pubPass); 
    73             pubUser = udao.addOrUpdate(pubUser); 
     73            pubuser.setPassword(pubPass); 
     74            pubuser = new UserDAO(session).addOrUpdate(pubuser); 
     75            log.debug(String.format("%s instantiated.", getClass())); 
    7476        } catch (Exception e) { 
    7577            log.error("Cannot instantiate system users security manager", e); 
Note: See TracChangeset for help on using the changeset viewer.