Пример #1
0
 /**
  * Registers the user in session and with the user tables in the database
  * and then forwards them to the return url
  */
 protected function register()
 {
     // data map
     $objData = new Xerxes_DataMap();
     // if the user was previously active under a local username
     // then reassign any saved records to the new username
     $oldUsername = $this->request->getSession("username");
     $oldRole = $this->request->getSession("role");
     if ($oldRole == "local") {
         $objData->reassignRecords($oldUsername, $this->user->username);
     }
     // add or update user in the database, get any values in the db not
     // specified here.
     $this->user = $objData->touchUser($this->user);
     // set main properties in session
     $this->request->setSession("username", $this->user->username);
     $this->request->setSession("role", $this->role);
     $configApplication = $this->registry->getConfig("BASE_WEB_PATH", false, "");
     $this->request->setSession("application", $configApplication);
     // store user's additional properties in session, so they can be used by
     // controller, and included in xml for views.
     $this->request->setSession("user_properties", $this->user->properties());
     // groups too empty array not null please.
     $this->request->setSession("user_groups", $this->user->usergroups);
     // set this object's id in session
     $this->request->setSession("auth", $this->id);
     // now forward them to the return url
     $this->request->setRedirect($this->return);
 }