Commit c3761cb2 authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Côme Bernigaud
Browse files

Fixes: #2407 Migrate class_user to simple-plugin

Conflicts:
	include/class_config.inc
	plugins/admin/users/tabs_user.inc
	plugins/personal/generic/class_user.inc
parent ba9c2e72
......@@ -19,59 +19,18 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class usertabs extends tabs
class usertabs extends simpleTabs
{
var $base;
/* Template adaption variables
*/
var $uid = '';
var $givenName = '';
var $sn = '';
function __construct($config, $data, $dn, $cat = '', $copied_object = NULL)
{
parent::__construct($config, $data, $dn, 'user', $copied_object);
$this->base = $this->getBaseObject()->base;
$this->uid = &$this->by_object['user']->uid;
$this->givenName = &$this->by_object['user']->givenName;
$this->sn = &$this->by_object['user']->sn;
/* Add references/acls/snapshots */
$this->addSpecialTabs();
}
function save_object($save_current = FALSE)
{
parent::save_object($save_current);
/* Update reference, transfer variables */
$baseobject = $this->getBaseObject();
foreach ($this->by_object as $name => &$obj) {
/* Don't touch base object */
if ($name != 'user') {
$obj->parent = &$this;
$obj->uid = $baseobject->uid;
$obj->givenName = $baseobject->givenName;
$obj->sn = $baseobject->sn;
}
/* Copy mail if needed */
if ($name == 'gofaxAccount') {
if (isset($this->by_object['mailAccount']) && $this->by_object['mailAccount']->is_account) {
$obj->mail = $this->by_object['mailAccount']->mail;
}
}
if (isset($this->by_object['gofaxAccount']) && isset($this->by_object['mailAccount']) && $this->by_object['mailAccount']->is_account) {
$this->by_object['gofaxAccount']->mail = $this->by_object['mailAccount']->mail;
}
unset($obj);
/* Update parent in base object */
$this->by_object['user']->parent = &$this;
/* Move facsimile / phone number if nessecary */
if (($this->last == 'user') && isset($this->by_object['gofaxAccount'])) {
if ($this->last == 'user' && isset($this->by_object['gofaxAccount'])) {
/* Move number to fax plugin */
$this->by_object['gofaxAccount']->facsimileTelephoneNumber =
$this->by_object['user']->facsimileTelephoneNumber;
......@@ -106,36 +65,5 @@ class usertabs extends tabs
/* Possibly change acl base */
$this->set_acl_base();
}
function save()
{
/* Check for new 'dn', in order to propagate the
'dn' to all plugins */
$baseobject = $this->getBaseObject();
$baseobject->update_new_dn();
if ($this->dn != 'new') {
$new_dn = $baseobject->new_dn;
if ($this->dn != $new_dn) {
/* Udpate acls */
$baseobject->update_acls($this->dn, $new_dn);
$baseobject->move($this->dn, $new_dn);
}
}
$this->dn = $baseobject->new_dn;
return parent::save();
}
function set_template_mode()
{
foreach ($this->by_object as $key => $obj) {
$this->by_object[$key]->is_template = TRUE;
}
}
}
?>
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment