| 1 |
<? |
<? |
| 2 |
|
/** |
| 3 |
|
* This file contains the Tracker::User module. |
| 4 |
|
* |
| 5 |
|
* @author Andreas Motl <andreas.motl@ilo.de> |
| 6 |
|
* @package org.netfrag.flib |
| 7 |
|
* @name Tracker::User |
| 8 |
|
* |
| 9 |
|
*/ |
| 10 |
|
|
| 11 |
|
|
| 12 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
| 13 |
// $Id$ |
// $Id$ |
| 14 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
| 15 |
// $Log$ |
// $Log$ |
| 16 |
|
// Revision 1.15 2004/03/11 21:04:48 jonen |
| 17 |
|
// +changed backend-functions to only get/save User ONLY not SOME object (security!) |
| 18 |
|
// |
| 19 |
|
// Revision 1.14 2003/07/02 11:02:09 joko |
| 20 |
|
// + fixed bug with create/_create |
| 21 |
|
// |
| 22 |
|
// Revision 1.13 2003/04/04 02:15:09 joko |
| 23 |
|
// renamed method of helper object |
| 24 |
|
// |
| 25 |
// Revision 1.12 2003/03/03 21:20:47 joko |
// Revision 1.12 2003/03/03 21:20:47 joko |
| 26 |
// mungled the namespaces |
// mungled the namespaces |
| 27 |
// |
// |
| 102 |
// |
// |
| 103 |
// ----------------------------------------------------------------------------- |
// ----------------------------------------------------------------------------- |
| 104 |
|
|
| 105 |
|
|
| 106 |
|
/** |
| 107 |
|
* This is the User class. |
| 108 |
|
* |
| 109 |
|
* @author Andreas Motl <andreas.motl@ilo.de> |
| 110 |
|
* @package org.netfrag.flib |
| 111 |
|
* @name Tracker::User |
| 112 |
|
* |
| 113 |
|
*/ |
| 114 |
class User { |
class User { |
| 115 |
|
|
| 116 |
var $state; |
var $state; |
| 148 |
$this->meta[data_ready] = 1; |
$this->meta[data_ready] = 1; |
| 149 |
//$this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) ); |
//$this->pObject = new ProxyObject($this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1) ); |
| 150 |
$rpcinfo = $this->site->configuration->get("rpcinfo"); |
$rpcinfo = $this->site->configuration->get("rpcinfo"); |
| 151 |
$this->pObject = mkObject('DesignPattern::RemoteProxy', $this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
//$this->pObject = mkObject('DesignPattern::RemoteProxy', $this->getUserGuid(), array( remote => 1, classname => "NetPerson", guid => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
| 152 |
if ($this->getUserGuid()) { |
$this->pObject = mkObject('DesignPattern::RemoteProxy', $this->getUserGuid(), array( key => 1, command => 'getUser', query => $this->getUserGuid(), remote => 1, rpcinfo => $rpcinfo, cache => array( db => 1, session => 1 ), connect => 1 ) ); |
| 153 |
$this->data = $this->pObject->getAttributes(); |
if ($this->getUserGuid()) { |
| 154 |
|
$this->data = $this->pObject->getResult(); |
| 155 |
} |
} |
| 156 |
} |
} |
| 157 |
|
|
| 170 |
|
|
| 171 |
function _save($type = '') { |
function _save($type = '') { |
| 172 |
//print Dumper($this->data); |
//print Dumper($this->data); |
| 173 |
$this->pObject->save($this->data, $type); |
//$this->pObject->save($this->data, $type); |
| 174 |
|
// new of 2004-03-08: don't use generic 'saveObject'!! |
| 175 |
|
// for security reasons disabled at ClientBackend!!! |
| 176 |
|
if($type == 'commit') { |
| 177 |
|
$args = array( 'guid' => $this->data[guid], 'data' => $this->data ); |
| 178 |
|
$this->pObject->backend->send('saveUser', $args, array( utf8 => 1) ); |
| 179 |
|
} |
| 180 |
// invalidate data only if it's not for caching purposes |
// invalidate data only if it's not for caching purposes |
| 181 |
if ($type != 'cache') { |
if ($type != 'cache') { |
| 182 |
$this->meta[data_ready] = 0; |
$this->meta[data_ready] = 0; |
| 190 |
|
|
| 191 |
function create() { |
function create() { |
| 192 |
$this->_save(); |
$this->_save(); |
| 193 |
$attr = $this->pObject->getAttributes(); |
$attr = $this->pObject->getResult(); |
| 194 |
//print DumpVar($attr); |
//print DumpVar($attr); |
| 195 |
$this->_create($attr); |
$this->_create($attr); |
| 196 |
} |
} |
| 197 |
|
|
| 198 |
function _create($result) { |
function _create($result) { |
| 199 |
|
global $site; |
| 200 |
//print "saving to backend: " . dumpVar($result) . "<br>"; |
//print "saving to backend: " . dumpVar($result) . "<br>"; |
| 201 |
$response = $this->pObject->backend->send('createUser', array('data' => $result) ); |
$response = $this->pObject->backend->send('createUser', array('data' => $result) ); |
| 202 |
$objectId = $response[oid]; |
$objectId = $response[oid]; |