From 174c1c78d4f353de0ab177665439d911666ca059 Mon Sep 17 00:00:00 2001 From: psc Date: Mon, 28 Sep 2009 08:46:50 +0000 Subject: [PATCH] Add a new button to objectgroups of workstations, that enables to let all member objects inherit from the objectgroup, instead of doing this manually from each object. (Trac: #3020) git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14360 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/ogroups/goto/class_termgroup.inc | 25 ++++++++++++++++++- .../goto/admin/ogroups/goto/termgroup.tpl | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/trunk/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc b/trunk/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc index 889acaf16..5bf886ddb 100644 --- a/trunk/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc +++ b/trunk/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc @@ -5,6 +5,9 @@ class termgroup extends plugin /* attribute list for save action */ var $members= array(); + /* Stores a list of the member dn's */ + var $member_dn = array(); + var $gotoMode = "locked"; var $gotoSyslogServer = ""; var $gotoNtpServer = array(); @@ -33,7 +36,7 @@ class termgroup extends plugin var $nfsservers = array(); var $swapservers = array(); var $member_of_ogroup= false; - + var $members_inherit_from_group = true; function termgroup (&$config, $dn= NULL, $parent= NULL) { @@ -61,6 +64,7 @@ class termgroup extends plugin if(isset($this->attrs['member'])){ for ($i= 0; $i<$this->attrs['member']['count']; $i++){ $member= $this->attrs['member'][$i]; + array_push($this->member_dn, $member); $ldap->cat($member, array('objectClass', 'macAddress', 'cn')); if ($ldap->success()){ $attrs = $ldap->fetch(); @@ -181,6 +185,11 @@ class termgroup extends plugin Handle requested action ***************/ + /* Handle the inherit to members button */ + if (isset($_POST['inheritToMembers'])) { + $this->members_inherit_from_group = true; + } + /* Watch for events */ if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate")) && isset($this->mapActions[$_POST['saction']]) ){ @@ -316,6 +325,9 @@ class termgroup extends plugin plugin::save(); + /* Tell members to inherit all attributes if the flag is set */ + $this->inherit_attributes_to_members(); + /*************** Prepare special vars ***************/ @@ -384,6 +396,17 @@ class termgroup extends plugin )); } + function inherit_attributes_to_members() + { + if ($this->members_inherit_from_group) { + foreach ($this->member_dn as $dn) { + $member_obj = new worktabs($this->config, $this->config->data['TABS']['WORKTABS'], $dn); + $member_obj->by_object['workgeneric']->set_everything_to_inherited(); + $member_obj->save(); + } + } + } + function PrepareForCopyPaste($source) { /* Create used ntp server array */ diff --git a/trunk/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl b/trunk/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl index af2d0a5d7..4c265def4 100644 --- a/trunk/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl +++ b/trunk/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl @@ -101,6 +101,7 @@ + -- 2.30.2