| 1401 |
} |
} |
| 1402 |
|
|
| 1403 |
function store( $updateNulls=false ) { |
function store( $updateNulls=false ) { |
| 1404 |
global $migrate; |
global $acl, $migrate; |
| 1405 |
if( $this->id AND !$migrate) $ret = $this->_db->updateObject( $this->_tbl, $this, $this->id, $updateNulls ); |
$section_value = 'users'; |
| 1406 |
else $ret = $this->_db->insertObject( $this->_tbl, $this, $this->id ); |
if( $this->id AND !$migrate) { |
| 1407 |
|
// update existing record |
| 1408 |
|
$ret = $this->_db->updateObject( $this->_tbl, $this, $this->id, $updateNulls ); |
| 1409 |
|
// syncronise ACL |
| 1410 |
|
// single group handled at the moment |
| 1411 |
|
// trivial to expand to multiple groups |
| 1412 |
|
$groups = $acl->get_object_groups( $section_value, $this->id, 'ARO' ); |
| 1413 |
|
$acl->del_group_object( $groups[0], $section_value, $this->id, 'ARO' ); |
| 1414 |
|
$acl->add_group_object( $this->gid, $section_value, $this->id, 'ARO' ); |
| 1415 |
|
$object_id = $acl->get_object_id( $section_value, $this->id, 'ARO' ); |
| 1416 |
|
$acl->edit_object( $object_id, $section_value, $this->_db->getEscaped( $this->name ), $this->id, 0, 0, 'ARO' ); |
| 1417 |
|
} |
| 1418 |
|
else { |
| 1419 |
|
// new record |
| 1420 |
|
$ret = $this->_db->insertObject( $this->_tbl, $this, 'id' ); |
| 1421 |
|
// syncronise ACL |
| 1422 |
|
$acl->add_object( $section_value, $this->_db->getEscaped( $this->name ), $this->id, null, null, 'ARO' ); |
| 1423 |
|
$acl->add_group_object( $this->gid, $section_value, $this->id, 'ARO' ); |
| 1424 |
|
} |
| 1425 |
if ($ret) return true; |
if ($ret) return true; |
| 1426 |
$this->_error = "mosUser::store failed <br />" . $this->_db->getErrorMsg(); |
$this->_error = "mosUser::store failed <br />" . $this->_db->getErrorMsg(); |
| 1427 |
return false; |
return false; |