diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc
index 6cace375b388c0cb07d80cf4c2bfc94bef5ffedb..22fb7ba96afc9c7cd624c7a21177d3b8924d9fd2 100644 (file)
foreach ($this->attributes as $attr){
$smarty->assign("$attr", $this->$attr);
$smarty->assign("$attr"."ACL", chkacl($this->acl, $attr));
+ $smarty->assign($attr."State","");
}
/* Classes... */
- foreach ($this->additionaloc as $oc => $dummy){
+foreach ($this->additionaloc as $oc => $dummy){
if (isset($this->objectclasses[$oc])){
$smarty->assign("$oc", "checked");
+ $smarty->assign("$oc"."State", "");
$smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
+
} else {
+ $smarty->assign("$oc", "");
+ $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
$smarty->assign("$oc"."State", "disabled");
}
}
+
+ if(isset($this->attrs['goXdmcpIsEnabled'])&&($this->attrs['goXdmcpIsEnabled']=="1"))
+ $smarty->assign("goXdmcpIsEnabled","checked");
+
return($smarty->fetch (get_template_path('servservice.tpl', TRUE)));
}
/* Save data to object */
function save_object()
{
- plugin::save_object();
-
- /* Save checkbox state */
- foreach ($this->additionaloc as $oc => $dummy){
- if (isset($_POST[$oc]) && $_POST[$oc] == '1'){
- $this->objectclasses[$oc]= $oc;
- } else {
- unset($this->objectclasses[$oc]);
+ if (isset($_POST['servicetab'])){
+ plugin::save_object();
+
+ /* Save checkbox state */
+ foreach ($this->additionaloc as $oc => $dummy){
+ if (isset($_POST[$oc]) && $_POST[$oc] == '1'){
+ $this->objectclasses[$oc]= $oc;
+ } else {
+ unset($this->objectclasses[$oc]);
+ }
}
}
/* Save to LDAP */
function save()
{
+
/* Normalize lazy objectclass arrays */
$objectclasses= array();
foreach($this->objectclasses as $oc){
$objectclasses[]= $oc;
}
-
- $this->objectclasses= $objectclasses;
plugin::save();
-
- /* Remove objectclasses */
- foreach(array_merge($this->objectclasses, $this->additionaloc) as $oc){
- foreach ($this->attrs['objectClass'] as $key => $value){
- if ($value == $oc){
- unset ($this->attrs['objectClass'][$key]);
- }
+
+ $test = $this->objectclasses;
+ $tmp = array_flip($this->attrs['objectClass']);
+
+
+
+ foreach($this->additionaloc as $key=>$val) {
+ unset($tmp[$key]);
}
- }
- $this->attrs['objectClass']=array();
- foreach($this->objectclasses as $oc){
- $this->attrs['objectClass'][]= $oc;
- }
+
+ $classes = (array_flip(array_merge(array_flip($test),$tmp)));
- /* Adapt sieve server if needed */
- if (in_array('goImapServer', $this->objectclasses)){
- $this->attrs['goImapSieveServer']= preg_replace('/:.*$/', '',
- preg_replace('/^{([^}]+)}$/', '\\1',
- $this->attrs['goImapConnect']));
+ unset($this->attrs['objectClass']);
+
+ foreach($classes as $class){
+ $this->attrs['objectClass'][]=$class;
}
+
/* Remove unneeded attributes */
foreach ($this->additionaloc as $oc => $attrs){
- if (!in_array($oc, $this->objectclasses)){
+ if (!in_array($oc, $this->attrs['objectClass'])){
foreach ($attrs as $attr){
$this->attrs[$attr]= array();
}
}
}
-
- print_a($this->attrs);
+ $this->attrs = array_reverse($this->attrs);
+
+ /* Check if we are able to set these attributes */
+#fixme : It Would be better to check ObjectClass rights to, but what is to do if there are insuficient rights
+ foreach($this->additionaloc as $oc => $attrs)
+ {
+ foreach($attrs as $val)
+ {
+ if(chkacl($this->acl,$val)=="")
+ {
+ unset($this->attrs[$val]);
+ unset($this->$val);
+ }
+ }
+ }
/* Write to LDAP */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->dn);
$ldap->modify($this->attrs);
show_ldap_error($ldap->get_error());
-
/* Optionally execute a command after we're done */
if ($this->initially_was_account == $this->is_account){
if ($this->is_modified){
} else {
$this->handle_post_events("add");
}
-
}
}