Changeset 466

Show
Ignore:
Timestamp:
02/01/08 20:56:25 (11 months ago)
Author:
padams
Message:

- refactored standalone installer to add default admin user after default site and eliminated sending the set password link via email.
- removed illegal whitespace from validator class.
- created user manager class to consolidate user code.

Location:
trunk
Files:
1 added
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/base/classes/mailer.php

    r241 r466  
    5757                $this->config = $c->fetch('base'); 
    5858                 
    59                 $this->e = &owa_error::get_instance(); 
     59                $this->e = &owa_coreApi::errorSingleton(); 
    6060                 
    6161                if (!empty($this->config['mailer-from'])): 
  • trunk/modules/base/classes/validator.php

    r241 r466  
    152152  
    153153?> 
    154   
  • trunk/modules/base/installAdminUser.php

    r364 r466  
    133133                                // Set user object Params 
    134134                                if (empty($id)): 
    135                  
    136                                 //Generate Initial Passkey and new account email 
    137                                 $auth->setInitialPasskey($this->params['user_id']); 
    138                          
    139                                 // log account creation event to event queue 
    140                                 $eq = &eventQueue::get_instance(); 
    141                                 $eq->log(array( 'user_id'               => $this->params['user_id'], 
    142                                                                 'real_name'     => $this->params['real_name'], 
    143                                                                 'role'                  => $this->params['role'], 
    144                                                                 'email_address' => $this->params['email_address']),  
    145                                                                 'base.new_user_account'); 
    146135                                 
    147                                 // return view 
    148                                 $data['view_method'] = 'redirect'; 
    149                                 $data['view'] = 'base.install'; 
    150                                 $data['subview'] = 'base.installDefaultSiteProfile'; 
    151                                 $data['status_code'] = 3304; 
     136                                        $userManager = owa_coreApi::supportClassFactory('base', 'userManager');                          
     137                                         
     138                                         
     139                                        $user_params = array( 'user_id'                 => $this->params['user_id'], 
     140                                                                                  'real_name'           => $this->params['real_name'], 
     141                                                                              'role'                    => $this->params['role'], 
     142                                                                          'email_address'       => $this->params['email_address']);  
     143                                                                           
     144                                        $temp_passkey = $userManager->createNewUser($user_params); 
     145                                         
     146                                        // return view 
     147                                        $data['view_method'] = 'redirect'; 
     148                                         
     149                                        $data['u'] = $this->params['user_id']; 
     150                                        $data['k'] = $temp_passkey; 
     151                                        $data['action'] = 'base.installFinish'; 
     152                                        $data['status_code'] = 3304; 
    152153                                 
    153154                                else: 
  • trunk/modules/base/installBase.php

    r249 r466  
    5050                        $data['view_method'] = 'redirect'; 
    5151                        $data['view'] = 'base.install'; 
    52                         $data['subview'] = 'base.installAdminUser'; 
     52                        $data['subview'] = 'base.installDefaultSiteProfile'; 
    5353                        $data['status_code'] = 3305; 
    5454                else: 
  • trunk/modules/base/installCheckEnv.php

    r241 r466  
    9797                // Check DB connection status 
    9898                $db = &owa_coreAPI::dbSingleton(); 
     99                $db->connect(); 
    99100                if ($db->connection_status != true): 
    100101                        $errors['count'] = $errors['count']++; 
  • trunk/modules/base/installDefaultSiteProfile.php

    r364 r466  
    123123                                 
    124124                                $data['view_method'] = 'redirect'; // Delegate, redirect 
    125                                 $data['action'] = 'base.installFinish'; 
     125                                $data['view'] = 'base.install'; 
     126                                $data['subview'] = 'base.installAdminUser'; 
    126127                                $data['status_code'] = 3303; 
    127128                                $data['site_id'] = $site->get('site_id'); 
  • trunk/modules/base/installFinish.php

    r364 r466  
    6161                endif; 
    6262                 
     63                 
     64                $site = owa_coreAPI::entityFactory('base.site'); 
     65                 
     66                $site->getByPk('id', '1'); 
     67                 
    6368                $data = array(); 
    6469                $data['view'] = 'base.install'; 
    6570                $data['subview'] = 'base.installFinish'; 
    6671                $data['view_method'] = 'delegate'; 
    67                 $data['site_id'] = $this->params['site_id']; 
     72                $data['site_id'] = $site->get('site_id'); 
    6873                $data['status_code'] = $this->params['status_code'];  
     74                $data['u'] = $this->params['u']; 
     75                $data['k'] = $this->params['k']; 
    6976                 
    7077                return $data; 
     
    97104                 
    98105                $this->body->set('site_id', $data['site_id']); 
     106                $this->body->set('u', $data['u']); 
     107                $this->body->set('key', $data['k']); 
    99108                // load body template 
    100109                $this->body->set_template('install_finish.tpl'); 
  • trunk/modules/base/templates/install.tpl

    r293 r466  
    88                <TD colspan="2"> 
    99                        <P> 
    10                                 Installation Steps: &nbsp; 
     10                                Install Steps: &nbsp; 
    1111                                <span class="<? if ($step == 'base.installStart'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Welcome</span> &nbsp; >> &nbsp; 
    1212                                <span class="<? if ($step == 'base.installCheckEnv'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Server Environment Check</span> &nbsp; >> &nbsp; 
    13                                 <span class="<? if ($step == 'base.installAdminUser'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Admin User Setup</span> &nbsp; >> &nbsp; 
    14                                 <span class="<? if ($step == 'base.installDefaultSiteProfile'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Site Profile Setup</span> &nbsp; >> &nbsp; 
    15                                 <span class="<? if ($step == 'base.installFinish'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Install Complete</span>   
     13                                <span class="<? if ($step == 'base.installDefaultSiteProfile'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Default Site Profile</span> &nbsp; >> &nbsp; 
     14                                <span class="<? if ($step == 'base.installAdminUser'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Admin User</span> &nbsp; >> &nbsp; 
     15                                <span class="<? if ($step == 'base.installFinish'):?>active_wizard_step<?else:?>wizard_step<?endif;?>">Finish</span>     
    1616                        </P> 
    1717                </TD> 
  • trunk/modules/base/templates/install_check_env.tpl

    r249 r466  
    3030                </TR> 
    3131                <TR>     
    32                         <TH scope="row">Log Directory Permissions</TH> 
     32                        <TH scope="row">File System Permissions</TH> 
    3333                        <TD class="<? if ($errors['log_dir_permission']):?>red 
    3434                                                        <?elseif ($warnings['log_dir_permission']):?>yellow 
     
    4343    <? if ($errors['count'] == 0):?> 
    4444        <DIV class="centered_buttons">   
    45                         <a href="<?=$this->makeLink(array('action' => 'base.installBase'));?>">Next >> Next Step: Admin User Setup</a> 
     45                        <a href="<?=$this->makeLink(array('action' => 'base.installBase'));?>">Next >> Next Step: Default Site Setup</a> 
    4646                </DIV> 
    4747        <? else:?> 
  • trunk/modules/base/templates/install_finish.tpl

    r238 r466  
    33<div class="subview_content"> 
    44         
    5         <h1>Installation Complete (you made it).</h1> 
     5        <h1>Installation Complete.   (wasn't that easy?)</h1> 
    66         
    7         <h1>But...</h1> 
    8          
    9         <h2>Before you can start tracking anything you must...</h2> 
     7        <h2>Before you can start using OWA you must...</h2> 
    108         
    119        <h3>1. Set Your Admin User Password</h3> 
    1210         
    13         An e-mail containing instructions on how to do this has been sent to the address that you registered with. 
     11        You must set the admin password of your account.  
     12         
     13        <table> 
     14                <TR> 
     15                        <TH>User Name:</TH> 
     16                        <TD><?=$u;?></TD> 
     17                </TR> 
     18                <TR> 
     19                        <TH>Password:</TH> 
     20                        <TD><a href="<?=$this->makeAbsoluteLink(array('view' => 'base.usersChangePassword', 'k' => $key));?>"> Click here to set password</a></TD> 
     21                </TR> 
     22        </table> 
    1423         
    1524        <h3>2. Place Javascript Tracking Tags or Use the PHP API</h3> 
  • trunk/modules/base/usersNewAccount.php

    r238 r466  
    4242        function action() { 
    4343                 
    44                 // save new user to db 
    45                 $auth = &owa_auth::get_instance(); 
    46                 $u = owa_coreAPI::entityFactory('base.user'); 
    47                 $u->set('user_id', $this->params['user_id']); 
    48                 $u->set('role', $this->params['role']); 
    49                 $u->set('real_name', $this->params['real_name']); 
    50                 $u->set('email_address', $this->params['email_address']); 
    51                 $u->set('temp_passkey', $auth->generateTempPasskey($this->params['user_id'])); 
    52                 $u->set('creation_date', time()); 
    53                 $u->set('last_update_date', time()); 
    54                 $u->create(); 
    55                  
     44                if ($this->params['just_email') == false): 
     45                        // save new user to db 
     46                        $auth = &owa_auth::get_instance(); 
     47                        $u = owa_coreAPI::entityFactory('base.user'); 
     48                        $u->set('user_id', $this->params['user_id']); 
     49                        $u->set('role', $this->params['role']); 
     50                        $u->set('real_name', $this->params['real_name']); 
     51                        $u->set('email_address', $this->params['email_address']); 
     52                        $u->set('temp_passkey', $auth->generateTempPasskey($this->params['user_id'])); 
     53                        $u->set('creation_date', time()); 
     54                        $u->set('last_update_date', time()); 
     55                        $u->create(); 
     56                endif; 
    5657                // return email view 
    5758                $data['user_id']= $this->params['user_id']; 
  • trunk/public/install.php

    r293 r466  
    3636$config['do_not_fetch_config_from_db'] = true; 
    3737$config['main_url'] = 'install.php'; 
     38$config['cache_objects'] = false; 
    3839$owa = new owa_php($config); 
    3940