summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65fa6af)
raw | patch | inline | side by side (parent: 65fa6af)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 19 Dec 2007 09:28:58 +0000 (09:28 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 19 Dec 2007 09:28:58 +0000 (09:28 +0000) |
-Samba, added sambaLogonHours
-Samba, added Workstation access
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8141 594d385d-05f5-0310-b6e9-bd551577e9d8
-Samba, added Workstation access
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8141 594d385d-05f5-0310-b6e9-bd551577e9d8
index 0241603ecffab35d9685ceaffbf92c3fe3093849..ceb49f2bf1b56ab94df65b0e4b74b94b21d2739d 100644 (file)
*/
function enable_multiple_support()
{
+ $this->ignore_account = TRUE;
$this->multiple_support_active = TRUE;
}
diff --git a/gosa-core/plugins/personal/samba/class_sambaAccount.inc b/gosa-core/plugins/personal/samba/class_sambaAccount.inc
index 4de21f4935a1f8635de40597eb705cd965fbd137..3a9cc0c28e1e9147bd0e6724aa395db52baacd7c 100644 (file)
var $CopyPasteVars = array("kickoff_time_set","logoff_time_set","logon_time_set","mungedObject","orig_sambaDomainName");
var $multiple_support = TRUE;
+
/* Only used for multiple edit */
var $temporary_disable = FALSE;
var $no_password_required = FALSE;
+ var $multiple_sambaUserWorkstations = array();
function sambaAccount (&$config, $dn= NULL)
{
return($this->dialog->execute());
}
-
/* Prepare templating */
$smarty= get_smarty();
if($this->acl_is_writeable("sambaUserWorkstations",$SkipWrite)){
- $tmp= $this->sambaUserWorkstations;
- foreach($_POST['workstation_list'] as $name){
- $tmp= preg_replace("/$name/", '', $tmp);
- $this->is_modified= TRUE;
+ if($this->multiple_support_active){
+ foreach($_POST['workstation_list'] as $name){
+ if(isset($this->multiple_sambaUserWorkstations[trim($name)])){
+ unset($this->multiple_sambaUserWorkstations[trim($name)]);
+ }
+ }
+ }else{
+ $tmp= $this->sambaUserWorkstations;
+ foreach($_POST['workstation_list'] as $name){
+ $tmp= preg_replace("/$name/", '', $tmp);
+ $this->is_modified= TRUE;
+ }
+ $tmp= preg_replace('/,+/', ',', $tmp);
+ $this->sambaUserWorkstations= trim($tmp, ',');
}
- $tmp= preg_replace('/,+/', ',', $tmp);
- $this->sambaUserWorkstations= trim($tmp, ',');
}
}
/* Add user workstation? */
if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
- $tmp= $this->sambaUserWorkstations;
- foreach($_POST['wslist'] as $ws){
- $tmp.= ",$ws";
+
+ if($this->multiple_support_active){
+ foreach($_POST['wslist'] as $ws){
+ $this->multiple_sambaUserWorkstations[trim($we)] = array("Name" => trim($ws), "UsedByAllUsers" => TRUE);
+ }
+ }else{
+ $tmp= $this->sambaUserWorkstations;
+ foreach($_POST['wslist'] as $ws){
+ $tmp.= ",$ws";
+ }
+ $tmp= preg_replace('/,+/', ',', $tmp);
+ $this->sambaUserWorkstations= trim($tmp, ',');
}
- $tmp= preg_replace('/,+/', ',', $tmp);
- $this->sambaUserWorkstations= trim($tmp, ',');
$this->is_modified= TRUE;
}
/* Get workstation list */
$exclude= "";
- foreach(split(',', $this->sambaUserWorkstations) as $ws){
- $exclude.= "(cn=$ws$)";
+
+ if($this->multiple_support_active){
+ foreach($this->multiple_sambaUserWorkstations as $ws){
+ if($ws['UsedByAllUsers']){
+ $exclude.= "(cn=".$ws['Name']."$)";
+ }
+ }
+ }else{
+ foreach(split(',', $this->sambaUserWorkstations) as $ws){
+ $exclude.= "(cn=$ws$)";
+ }
}
if ($exclude != ""){
$exclude= "(!(|$exclude))";
$smarty->assign("CtxMaxIdleTimeF",
$this->mungedObject->getCtxMaxIdleTimeF()?"checked":"");
+
/* Fill sambaUserWorkstations */
$ws= split(",", $this->sambaUserWorkstations);
sort($ws);
/* Tidy checks for empty option, and smarty will produce one if array[0]="" */
if(($ws[0]=="")&&(count($ws)==1)) $ws=array();
+ if($this->multiple_support_active){
+ $smarty->assign("multiple_workstations",$this->multiple_sambaUserWorkstations);
+ }
$smarty->assign("workstations", $ws);
}
function multiple_save_object()
{
- $this->save_object();
- plugin::multiple_save_object();
- foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath",
- "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
- "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
- "onnectclientprinters","defaultprinter","shadow","brokenconn",
- "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable",
- "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
- "workstation_list") as $attr){
- if(isset($_POST["use_".$attr])){
- $this->multi_boxes[] = $attr;
+ if (isset($_POST['sambaTab'])){
+ $this->save_object();
+ plugin::multiple_save_object();
+ foreach(array("allow_pwchange","tslogin","CtxWFHomeDir","CtxWFHomeDirDrive","CtxWFProfilePath",
+ "inherit","CtxWorkDirectory","CtxInitialProgram","CtxMaxConnectionTimeF","CtxMaxConnectionTime","CtxMaxDisconnectionTimeF",
+ "CtxMaxDisconnectionTime","CtxMaxIdleTimeF","CtxMaxIdleTime","connectclientdrives",
+ "onnectclientprinters","defaultprinter","shadow","brokenconn",
+ "reconn","allow_pwchange","connectclientprinters","no_password_required","temporary_disable",
+ "password_expires","logon_time_set","logoff_time_set","kickoff_time_set","SetSambaLogonHours",
+ "workstation_list") as $attr){
+ if(isset($_POST["use_".$attr])){
+ $this->multi_boxes[] = $attr;
+ }
+ }
+ }
+ }
+
+
+ function get_multi_init_values()
+ {
+ $ret = plugin::get_multi_init_values();
+
+ /* Parse given sambaUserWorkstations into array
+ * to allow "init_multiple_support()" to detect multiple used workstations.
+ * Those workstations will be displayed in light grey.
+ */
+ $tmp2 = array("count" => 0);
+ $tmp = split(",", $this->sambaUserWorkstations);
+ foreach($tmp as $station){
+ $station = trim($station);
+ if(!empty($station)){
+ $tmp2[] = $station;
+ $tmp2['count'] ++;
+ }
+ }
+ $ret['sambaUserWorkstations'] = $tmp2;
+ return($ret);
+ }
+
+
+
+ function init_multiple_support($attrs,$all)
+ {
+ plugin::init_multiple_support($attrs,$all);
+
+ $this->multiple_sambaUserWorkstations = array();
+ if(isset($all['sambaUserWorkstations'])){
+ for($i = 0 ; $i < $all['sambaUserWorkstations']['count'] ; $i++){
+ $station = trim($all['sambaUserWorkstations'][$i]);
+ $this->multiple_sambaUserWorkstations[$station] = array("Name" => $station, "UsedByAllUsers" => FALSE);
+ }
+ }
+ if(isset($attrs['sambaUserWorkstations'])){
+ for($i = 0 ; $i < $attrs['sambaUserWorkstations']['count'] ; $i++){
+ $station = trim($attrs['sambaUserWorkstations'][$i]);
+ $this->multiple_sambaUserWorkstations[$station] = array("Name" => $station, "UsedByAllUsers" => TRUE);
}
}
}
if(in_array("temporary_disable",$this->multi_boxes)){
$ret['temporary_disable'] = $this->temporary_disable;
}
+
+ if(in_array("SetSambaLogonHours",$this->multi_boxes)){
+ $ret['sambaLogonHours'] = $this->sambaLogonHours;
+ }
+ if(in_array("workstation_list",$this->multi_boxes)){
+ $ret['multiple_sambaUserWorkstations'] = $this->multiple_sambaUserWorkstations;
+ }
return($ret);
}
{
plugin::set_multi_edit_values($values);
+ /* Prepare current workstation settings to be merged
+ * with multiple edit settings.
+ */
+ if(isset($values['multiple_sambaUserWorkstations'])){
+ $cur_ws = array();
+ $m_ws = $values['multiple_sambaUserWorkstations'];
+
+ /* Prepare current settings to be merged */
+ if(isset($this->sambaUserWorkstations)){
+ $ttmp = split(",",$this->sambaUserWorkstations);
+ foreach($ttmp as $station){
+ $station = trim($station);
+ if(!empty($station)){
+ $cur_ws[$station] = array("Name" => $station, "UsedByAllUsers" => TRUE);
+ }
+ }
+ }
+
+ /* Unset removed workstations */
+ foreach($cur_ws as $cur_name => $cur_station){
+ if(!isset($m_ws[$cur_name])){
+ unset($cur_ws[$cur_name]);
+ }
+ }
+
+ /* Add all added workstations */
+ foreach($m_ws as $name => $station){
+ if($station['UsedByAllUsers']){
+ $cur_ws[$name] = $station;
+ }
+ }
+
+ $this->sambaUserWorkstations = "";
+ foreach($cur_ws as $name => $ws){
+ $this->sambaUserWorkstations .= $name.",";
+ }
+ $this->sambaUserWorkstations=preg_replace("/,$/","",$this->sambaUserWorkstations);
+ }
+
/* Enable disabled terminal login, this is inverted somehow */
if(isset($values['tslogin'])) $this->mungedObject->setTsLogin(!$values['tslogin']);
diff --git a/gosa-core/plugins/personal/samba/class_sambaLogonHours.inc b/gosa-core/plugins/personal/samba/class_sambaLogonHours.inc
index 95de60d0ad5aae2b74ae4d9fc79bbb74bb668206..615254dec015e47174e15cc35a93f27ce7bc6120 100644 (file)
$ui =get_userinfo();
$smarty = get_smarty();
- $smarty->assign("sambaLogonHoursACL",$ui->get_permissions($this->acl_base,"user/generic","sambaLogonHours"));
$smarty->assign("Matrix",$this->Matrix);
$smarty->assign("Days" ,$week_days);
$smarty->assign("Hours" ,$hours);
$ui = get_userinfo();
/* Check if dialog was opened and if there were any changes */
- if(isset($_POST['sambaLogonHoursPosted']) && preg_match("/w/i",$ui->get_permissions($this->acl_base,"user/generic","sambaLogonHours"))){
+ if(isset($_POST['sambaLogonHoursPosted'])){
foreach($this->Matrix as $day_key => $days){
foreach($days as $hour_key => $hour){
if(isset($_POST['day_'.$day_key.'_'.$hour_key])){
diff --git a/gosa-core/plugins/personal/samba/samba3.tpl b/gosa-core/plugins/personal/samba/samba3.tpl
index 6dbd266d4d255f8350362a07e682cef5a6cae124..ab0bfb0259e65a84ecf35811b0024faf7bdf7475 100644 (file)
{if $multiple_support}
<input type="checkbox" name="use_workstation_list" {if $use_workstation_list} checked {/if} class="center"
onClick="changeState('workstation_list');">
-{/if}
-{render acl=$sambaUserWorkstationsACL}
- <select {if $multiple_support && !$use_workstation_list} disabled {/if} id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
- {html_options values=$workstations output=$workstations}
+ <select {if $multiple_support && !$use_workstation_list} disabled {/if}
+ id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
+
+ {foreach from=$multiple_workstations item=item key=key}
+ {if $item.UsedByAllUsers}
+ <option value="{$key}">{$item.Name} ({t}Used by all users{/t})</option>
+ {else}
+ <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;'
+ value="{$key}">{$item.Name} ({t}Used by some users{/t})</option>
+ {/if}
+ {/foreach}
</select>
-{/render}
<br>
-{render acl=$sambaUserWorkstationsACL}
<input type="submit" value="{t}Add{/t}" name="add_ws">
-{/render}
-{render acl=$sambaUserWorkstationsACL}
<input type="submit" value="{t}Delete{/t}" name="delete_ws">
-{/render}
+{else}
+ {render acl=$sambaUserWorkstationsACL}
+ <select id="workstation_list" style="width:100%;" name="workstation_list[]" size=10 multiple>
+ {html_options values=$workstations output=$workstations}
+ </select>
+ {/render}
+ <br>
+ {render acl=$sambaUserWorkstationsACL}
+ <input type="submit" value="{t}Add{/t}" name="add_ws">
+ {/render}
+ {render acl=$sambaUserWorkstationsACL}
+ <input type="submit" value="{t}Delete{/t}" name="delete_ws">
+ {/render}
+{/if}
</td>
</tr>
</table>
diff --git a/gosa-core/plugins/personal/samba/sambaLogonHours.tpl b/gosa-core/plugins/personal/samba/sambaLogonHours.tpl
index 1eb730608ac7e02d27d68e46b68eedbda6e03773..90cb88e53857a8c954f8eb1051fcdfb203a16c87 100644 (file)
<td style="text-align:center; height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px #B0B0B0; text-align: right;">
{/if}
-{render acl=$sambaLogonHoursACL}
<input type='button' onClick="toggle_chk('^day_[0-9]*_{$hours}$');" value='+/-' style='width:100%;'>
-{/render}
</td>
{/foreach}
<td>
-{render acl=$sambaLogonHoursACL}
<input type='button' onClick="toggle_chk('^day_[0-9]*_[0-9]*$');" value='+/-' style='width:100%;'>
-{/render}
</td>
</tr>
<td style="text-align:center;height: 22px; background-color: rgb(245, 245, 245); border-right: solid 1px;">
{/if}
{if $Matrix[$key_day].$key_hour}
-{render acl=$sambaLogonHoursACL}
<input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' checked >
-{/render}
{else}
-{render acl=$sambaLogonHoursACL}
<input id='day_{$key_day}_{$key_hour}' type='checkbox' name='day_{$key_day}_{$key_hour}' >
-{/render}
{/if}
</td>
{/foreach}
<!-- Add toggle button for days -->
<td>
-{render acl=$sambaLogonHoursACL}
<input type='button' onClick="toggle_chk('^day_{$key_day}_[0-9]*$')" value='+/-' style='padding:0px;margin:0px;'>
-{/render}
</td>
</tr>
{/foreach}