From b8d436d1f815ccd1d30a4b4eda33187369424ea9 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 1 Oct 2009 12:53:25 +0000 Subject: [PATCH] Added inherit all checkbox for ogroups with workstations git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14445 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/ogroups/goto/class_termgroup.inc | 25 ++++++++++++++++++- .../goto/admin/ogroups/goto/termgroup.tpl | 5 +++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc b/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc index 53556ea08..26175895a 100644 --- a/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc +++ b/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 = false; 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(); @@ -288,6 +292,7 @@ class termgroup extends plugin /* Show main page */ + $smarty->assign("members_inherit_from_group", $this->members_inherit_from_group); return ($smarty->fetch (get_template_path('termgroup.tpl', TRUE, dirname(__FILE__)))); } @@ -297,6 +302,10 @@ class termgroup extends plugin plugin::save_object(); /* Set inherit mode */ if(isset($_POST['workgeneric_posted'])){ + + /* Handle the inherit to members button */ + $this->members_inherit_from_group = isset($_POST['members_inherit_from_group']); + if(isset($_POST["inheritTimeServer"])){ $this->inheritTimeServer = true; }else{ @@ -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/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl b/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl index af2d0a5d7..dd103f918 100644 --- a/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl +++ b/gosa-plugins/goto/admin/ogroups/goto/termgroup.tpl @@ -100,7 +100,10 @@ - + + +   +{t}Inherit all values to group members{/t} -- 2.30.2