From 6e4dceb98182e69f502575c14b69d8153c4ade7d Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 24 Feb 2010 11:37:06 +0000 Subject: [PATCH] Added manager attribute to departments git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@15692 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../departments/class_countryGeneric.inc | 7 +- .../admin/departments/class_dcObject.inc | 7 +- .../admin/departments/class_department.inc | 66 ++++++++++++++++++- .../admin/departments/class_domain.inc | 7 +- .../departments/class_localityGeneric.inc | 7 +- .../departments/class_organizationGeneric.inc | 8 ++- .../plugins/admin/departments/country.tpl | 23 +++++++ .../plugins/admin/departments/dcObject.tpl | 23 +++++++ .../plugins/admin/departments/domain.tpl | 23 +++++++ .../plugins/admin/departments/generic.tpl | 24 +++++++ .../plugins/admin/departments/locality.tpl | 23 +++++++ .../admin/departments/organization.tpl | 23 +++++++ 12 files changed, 234 insertions(+), 7 deletions(-) diff --git a/gosa-core/plugins/admin/departments/class_countryGeneric.inc b/gosa-core/plugins/admin/departments/class_countryGeneric.inc index da87b9150..f69343431 100644 --- a/gosa-core/plugins/admin/departments/class_countryGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_countryGeneric.inc @@ -23,7 +23,7 @@ class country extends department { /* attribute list for save action */ - var $attributes = array( "c", "ou", "description","gosaUnitTag"); + var $attributes = array( "c", "ou", "description","gosaUnitTag", "manager"); var $objectclasses = array("top", "gosaDepartment"); var $structuralOC = array("country"); var $type ="country"; @@ -31,6 +31,10 @@ class country extends department var $orgi_c =""; var $namingAttr = "c"; + var $manager_enabled = FALSE; + var $manager_name =""; + var $manager =""; + function check() { @@ -86,6 +90,7 @@ class country extends department "plProvidedAcls" => array( "c" => _("Country name"), "description" => _("Description"), + "manager" => _("Manager"), "base" => _("Base"), "gosaUnitTag" => _("Administrative settings")) )); diff --git a/gosa-core/plugins/admin/departments/class_dcObject.inc b/gosa-core/plugins/admin/departments/class_dcObject.inc index 246e6539d..c4423d7fa 100644 --- a/gosa-core/plugins/admin/departments/class_dcObject.inc +++ b/gosa-core/plugins/admin/departments/class_dcObject.inc @@ -23,7 +23,7 @@ class dcObject extends department { /* attribute list for save action */ - var $attributes = array( "dc", "ou", "description","gosaUnitTag"); + var $attributes = array( "dc", "ou", "description","gosaUnitTag", "manager"); var $objectclasses = array("top", "dcObject", "gosaDepartment"); var $structuralOC = array("locality"); var $type = "dcObject"; @@ -31,6 +31,10 @@ class dcObject extends department var $orgi_dc = ""; var $namingAttr = "dc"; + var $manager_enabled = FALSE; + var $manager_name =""; + var $manager =""; + function check() { @@ -85,6 +89,7 @@ class dcObject extends department "plProvidedAcls" => array( "dc" => _("Name"), "description" => _("Description"), + "manager" => _("Manager"), "base" => _("Base"), "gosaUnitTag" => _("Administrative settings")) )); diff --git a/gosa-core/plugins/admin/departments/class_department.inc b/gosa-core/plugins/admin/departments/class_department.inc index ba0cc5709..859ec3f9a 100644 --- a/gosa-core/plugins/admin/departments/class_department.inc +++ b/gosa-core/plugins/admin/departments/class_department.inc @@ -46,7 +46,7 @@ class department extends plugin /* attribute list for save action */ var $attributes= array("ou", "description", "businessCategory", "st", "l", "postalAddress", - "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag"); + "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag", "manager"); /* Do not append the structural object classes here, they are added dynamically in the constructor */ var $objectclasses= array("top", "gosaDepartment"); @@ -57,6 +57,10 @@ class department extends plugin var $orig_ou = ""; var $baseSelector; + var $manager_enabled = FALSE; + var $manager_name =""; + var $manager =""; + function department (&$config, $dn) { /* Add the default structural obejct class 'locality' if this is a new entry @@ -120,6 +124,28 @@ class department extends plugin $this->baseSelector->setSubmitButton(false); $this->baseSelector->setHeight(300); $this->baseSelector->update(true); + + + + // If the 'manager' attribute is present in gosaDepartment allow to manage it. + $ldap = $this->config->get_ldap_link(); + $ocs = $ldap->get_objectclasses(); + if(isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['gosaDepartment']['MAY'])){ + $this->manager_enabled = TRUE; + + // Detect the managers name + $this->manager_name = ""; + $ldap = $this->config->get_ldap_link(); + if(!empty($this->manager)){ + $ldap->cat($this->manager, array('cn')); + if($ldap->count()){ + $attrs = $ldap->fetch(); + $this->manager_name = $attrs['cn'][0]; + }else{ + $this->manager_name = "("._("Unknown")."!): ".$this->manager; + } + } + } } function execute() @@ -137,7 +163,42 @@ class department extends plugin $this->config->get_departments($this->dn); $this->config->make_idepartments(); $smarty= get_smarty(); - $smarty->assign("usePrototype", "true"); + $smarty->assign("usePrototype", "true"); + + // Clear manager attribute if requested + if(preg_match("/ removeManager/i", " ".implode(array_keys($_POST),' ')." ")){ + $this->manager = ""; + $this->manager_name = ""; + } + + // Allow to manager manager attribute + if($this->manager_enabled){ + + // Allow to select a new inetOrgPersion:manager + if(preg_match("/ editManager/i", " ".implode(array_keys($_POST),' ')." ")){ + $this->dialog = new singleUserSelect($this->config, get_userinfo()); + } + if($this->dialog && count($this->dialog->detectPostActions())){ + $users = $this->dialog->detectPostActions(); + if(isset($users['targets']) && count($users['targets'])){ + + $headpage = $this->dialog->getHeadpage(); + $dn = $users['targets'][0]; + $attrs = $headpage->getEntry($dn); + $this->manager = $dn; + $this->manager_name = $attrs['cn'][0]; + $this->dialog = NULL; + } + } + if(isset($_POST['add_users_cancel'])){ + $this->dialog = NULL; + } + if($this->dialog) return($this->dialog->execute()); + } + $smarty->assign("manager",$this->manager); + $smarty->assign("manager_name",$this->manager_name); + $smarty->assign("manager_enabled",$this->manager_enabled); + $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ @@ -611,6 +672,7 @@ class department extends plugin "postalAddress" => _("Address"), "telephoneNumber" => _("Telephone"), "facsimileTelephoneNumber" => _("Fax"), + "manager" => _("Manager"), "gosaUnitTag" => _("Administrative settings")) )); diff --git a/gosa-core/plugins/admin/departments/class_domain.inc b/gosa-core/plugins/admin/departments/class_domain.inc index 1e37d2b7b..560503a7d 100644 --- a/gosa-core/plugins/admin/departments/class_domain.inc +++ b/gosa-core/plugins/admin/departments/class_domain.inc @@ -23,7 +23,7 @@ class domain extends department { /* attribute list for save action */ - var $attributes = array( "dc", "ou", "description","gosaUnitTag"); + var $attributes = array( "dc", "ou", "description","gosaUnitTag", "manager"); var $objectclasses = array("top", "domain", "gosaDepartment"); var $structuralOC = array("domain"); var $type = "domain"; @@ -31,6 +31,10 @@ class domain extends department var $orgi_dc = ""; var $namingAttr = "dc"; + var $manager_enabled = FALSE; + var $manager_name =""; + var $manager =""; + function check() { @@ -86,6 +90,7 @@ class domain extends department "dc" => _("Name"), "description" => _("Description"), "base" => _("Base"), + "manager" => _("Manager"), "gosaUnitTag" => _("Administrative settings")) )); } diff --git a/gosa-core/plugins/admin/departments/class_localityGeneric.inc b/gosa-core/plugins/admin/departments/class_localityGeneric.inc index 5394bcbd8..9c435ee41 100644 --- a/gosa-core/plugins/admin/departments/class_localityGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_localityGeneric.inc @@ -23,7 +23,7 @@ class locality extends department { /* attribute list for save action */ - var $attributes = array("l", "description", "ou", "gosaUnitTag"); + var $attributes = array("l", "description", "ou", "gosaUnitTag", "manager"); var $objectclasses = array("top", "gosaDepartment"); var $structuralOC = array("locality"); @@ -33,6 +33,10 @@ class locality extends department var $orig_l = ""; var $namingAttr = "l"; + var $manager_enabled = FALSE; + var $manager_name =""; + var $manager =""; + function check() { $message = plugin::check(); @@ -86,6 +90,7 @@ class locality extends department "plProvidedAcls" => array( "l" => _("Location"), "description" => _("Description"), + "manager" => _("Manager"), "base" => _("Base"), "gosaUnitTag" => _("Administrative settings")) )); diff --git a/gosa-core/plugins/admin/departments/class_organizationGeneric.inc b/gosa-core/plugins/admin/departments/class_organizationGeneric.inc index ead3c230f..7f55361f9 100644 --- a/gosa-core/plugins/admin/departments/class_organizationGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_organizationGeneric.inc @@ -24,7 +24,7 @@ class organization extends department { /* attribute list for save action */ var $attributes = array( "o", "ou", "description","userPassword","searchGuide", - "seeAlso","businessCategory","x121Address","registeredAddress", + "seeAlso","businessCategory","x121Address","registeredAddress","manager", "destinationIndicator","preferredDeliveryMethod","telexNumber", "telephoneNumber","internationaliSDNNumber","facsimileTelephoneNumber","street", "postOfficeBox","postalCode", "postalAddress","physicalDeliveryOfficeName", @@ -64,6 +64,10 @@ class organization extends department var $orgi_o = ""; var $namingAttr = "o"; + var $manager_enabled = FALSE; + var $manager_name =""; + var $manager =""; + function check() { $message = plugin::check(); @@ -120,6 +124,8 @@ class organization extends department "businessCategory" => _("Category"), "base" => _("Base"), + "manager" => _("Manager"), + "st" => _("State"), "l" => _("Location"), "postalAddress" => _("Postal address"), diff --git a/gosa-core/plugins/admin/departments/country.tpl b/gosa-core/plugins/admin/departments/country.tpl index eff9c73a1..d3da83a1a 100644 --- a/gosa-core/plugins/admin/departments/country.tpl +++ b/gosa-core/plugins/admin/departments/country.tpl @@ -33,6 +33,29 @@ {/if} + + {if $manager_enabled} + + + +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {if $manager!=""} +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {/if} + + + {/if} diff --git a/gosa-core/plugins/admin/departments/dcObject.tpl b/gosa-core/plugins/admin/departments/dcObject.tpl index 51a6ec459..23c7aa466 100644 --- a/gosa-core/plugins/admin/departments/dcObject.tpl +++ b/gosa-core/plugins/admin/departments/dcObject.tpl @@ -33,6 +33,29 @@ {/if} + + {if $manager_enabled} + + + +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {if $manager!=""} +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {/if} + + + {/if} diff --git a/gosa-core/plugins/admin/departments/domain.tpl b/gosa-core/plugins/admin/departments/domain.tpl index c30170e6a..a686ed9cf 100644 --- a/gosa-core/plugins/admin/departments/domain.tpl +++ b/gosa-core/plugins/admin/departments/domain.tpl @@ -33,6 +33,29 @@ {/if} + + {if $manager_enabled} + + + +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {if $manager!=""} +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {/if} + + + {/if} diff --git a/gosa-core/plugins/admin/departments/generic.tpl b/gosa-core/plugins/admin/departments/generic.tpl index 022098f82..5e0dd79df 100644 --- a/gosa-core/plugins/admin/departments/generic.tpl +++ b/gosa-core/plugins/admin/departments/generic.tpl @@ -45,6 +45,30 @@ {/if} + + {if $manager_enabled} + + + +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {if $manager!=""} +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {/if} + + + {/if} + diff --git a/gosa-core/plugins/admin/departments/locality.tpl b/gosa-core/plugins/admin/departments/locality.tpl index e009c37f8..d84781458 100644 --- a/gosa-core/plugins/admin/departments/locality.tpl +++ b/gosa-core/plugins/admin/departments/locality.tpl @@ -33,6 +33,29 @@ {/if} + + {if $manager_enabled} + + + +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {if $manager!=""} +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {/if} + + + {/if} diff --git a/gosa-core/plugins/admin/departments/organization.tpl b/gosa-core/plugins/admin/departments/organization.tpl index e7c825ce4..8ee12f983 100644 --- a/gosa-core/plugins/admin/departments/organization.tpl +++ b/gosa-core/plugins/admin/departments/organization.tpl @@ -45,6 +45,29 @@ {/if} + + {if $manager_enabled} + + + +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {if $manager!=""} +{render acl=$managerACL} + +{/render} +{render acl=$managerACL} + +{/render} + {/if} + + + {/if} -- 2.30.2