|
From: <al...@us...> - 2008-10-15 19:41:59
|
Revision: 726
http://sciret.svn.sourceforge.net/sciret/?rev=726&view=rev
Author: alpeb
Date: 2008-10-15 19:41:55 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
added some temporary hacks to share user obj in session with other apps
Modified Paths:
--------------
trunk/index.php
trunk/models/User.php
Modified: trunk/index.php
===================================================================
--- trunk/index.php 2008-10-15 18:57:19 UTC (rev 725)
+++ trunk/index.php 2008-10-15 19:41:55 UTC (rev 726)
@@ -109,10 +109,17 @@
$users = new Users();
$user = $auth->getStorage()->read();
$user->init();
- if ($user->app == 'monkeys') {
+
+ /**
+ * This is to juggle between this apps user obj and the other apps user objs.
+ * @todo: remove this when LDAP support is implemented
+ */
+ if ($user->app != 'sciret') {
$publicId = $user->publicId;
$user = $users->getRowInstance($publicId);
$user->app = 'sciret';
+ $user->publicId = $publicId;
+ $user->init();
$auth->getStorage()->write($user);
}
Modified: trunk/models/User.php
===================================================================
--- trunk/models/User.php 2008-10-15 18:57:19 UTC (rev 725)
+++ trunk/models/User.php 2008-10-15 19:41:55 UTC (rev 726)
@@ -35,12 +35,19 @@
$this->publicId = $this->id;
}
- if ($this->preferences) {
- // this has to go here because when the object has been fetched from the DB,
- // when init() is called it already has the fields filled in.
- // It has to go under __set() below too, because when the object is initialized through
- // createRow(), then when init() is called the fields haven't been initialized yet :/
- $this->_initPreferencesArr($this->preferences);
+ /**
+ * Might throw an exception when using user object comming from another app
+ * @todo: remove this when LDAP support is implemented
+ */
+ try {
+ if ($this->preferences) {
+ // this has to go here because when the object has been fetched from the DB,
+ // when init() is called it already has the fields filled in.
+ // It has to go under __set() below too, because when the object is initialized through
+ // createRow(), then when init() is called the fields haven't been initialized yet :/
+ $this->_initPreferencesArr($this->preferences);
+ }
+ } catch (Zend_Db_Table_Row_Exception $e) {
}
}
@@ -77,6 +84,11 @@
return parent::__set($name, $value);
}
+ public function __sleep()
+ {
+ return array_merge(array('app', 'publicId'), parent::__sleep());
+ }
+
public function save()
{
$this->preferences = serialize($this->_preferencesArr);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|