diff --git a/gosa-plugins/samba/admin/systems/samba/class_winGeneric.inc b/gosa-plugins/samba/admin/systems/samba/class_winGeneric.inc
index 66ec3effdb58f64a8beca8c1fc4e3f7e0fd105cb..56943662cd4b9cdf341355be1f571b2c4280b606 100644 (file)
"shadowInactive","uid","cn","sn","givenName","homeDirectory","sambaSID",
"sambaPrimaryGroupSID","displayName", "sambaPwdMustChange",
"sambaNTPassword","sambaPwdLastSet","sambaAcctFlags");
- var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","gosaAccount","shadowAccount","sambaSamAccount","top");
+ var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","shadowAccount","sambaSamAccount","top");
var $view_logged = FALSE;
plugin::plugin ($config, $dn, $parent);
$this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses,FALSE,"uid");
$this->netConfigDNS->cn = preg_replace("/\\\$\$/","",$this->uid);
- $this->netConfigDNS->objectclasses=array("ipHost","ieee802Device");
$this->netConfigDNS->MACisMust = FALSE;
$this->netConfigDNS->IPisMust = FALSE;
+ // The combination of the used objectClasses may differ, remember the initial ones.
+ if(isset($this->attrs['objectClass'])){
+ $this->objectclasses = array();
+ for($i=0; $i < $this->attrs['objectClass']['count'] ; $i++ ){
+ $this->objectclasses[] = $this->attrs['objectClass'][$i];
+ }
+ }
+
/* Set base */
if ($this->dn == "new"){
$ui = get_userinfo();
$this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
$this->cn= "";
+ } elseif(class_available("ArpNewDevice") &&
+ preg_match("/".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $this->dn)){
+ $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", "", $this->dn);
} else {
$this->base= preg_replace ("/^[^,]+,".preg_quote(get_winstations_ou(), '/')."/i", "", $this->dn);
}
/* Fill templating stuff */
$smarty= get_smarty();
- $smarty->assign("usePrototype", "true");
+
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $name => $translated){
/* Assign attributes */
foreach ($this->attributes as $attr){
- $smarty->assign("$attr", $this->$attr);
+ $smarty->assign("$attr", set_post($this->$attr));
}
$smarty->assign("base", $this->baseSelector->render());
/* Call common method to give check the hook */
$message= plugin::check();
$message= array_merge($message, $this->netConfigDNS->check());
- $this->dn= "cn=".$this->uid.",".get_ou('sambaMachineAccountRDN').$this->base;
+ $this->dn= "cn=".$this->uid.",".get_ou("wingeneric", "sambaMachineAccountRDN").$this->base;
if(!$this->acl_is_createable()){
$message[]= msgPool::permCreate();
$this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
}
+ $curOcs = $this->attrs['objectClass'];
+ $this->cleanup();
+
+ // Prepare list of object classes
+ $ocs = array();
+ if(!empty($this->netConfigDNS->macAddress)){
+ $ocs [] = 'ieee802Device';
+ }else{
+ $curOcs = array_remove_entries(array('ieee802Device'), $curOcs);
+ $this->attrs['macAddress'] = array();
+ }
+ if(!empty($this->netConfigDNS->ipHostNumber)){
+ $ocs [] = 'ipHost';
+ }else{
+ $curOcs = array_remove_entries(array('ipHost'), $curOcs);
+ $this->attrs['ipHostNumber'] = array();
+ }
+
+ $this->attrs['objectClass']=$curOcs;
+
/* Write back to ldap */
$ldap= $this->config->get_ldap_link();
if ($this->orig_dn == 'new'){
}
$ldap->cd($this->dn);
- $this->cleanup();
$ldap->modify ($this->attrs);
new log("modify","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$this->handle_post_events("modify");
}
- $this->netConfigDNS->cn = preg_replace("/\\\$\$/","",$this->uid);
- $this->netConfigDNS->save();
if (!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
}
- /* Optionally execute a command after we're done */
- $this->postcreate();
+ // Prepare list of object classes
+ $ocs = array();
+ if(!empty($this->netConfigDNS->macAddress)){
+ $ocs [] = 'ieee802Device';
+ }
+ if(!empty($this->netConfigDNS->ipHostNumber)){
+ $ocs [] = 'ipHost';
+ }
+
+ $this->netConfigDNS->objectclasses=$ocs;
+ $this->netConfigDNS->cn = preg_replace("/\\\$\$/","",$this->uid);
+ $this->netConfigDNS->save();
}
/* Return plugin informations for acl handling
#FIXME FAIscript seams to ununsed within this class... */
static function plInfo()
{
- return (array(
- "plShortName" => _("Win generic"),
- "plDescription" => _("Windows workstation generic"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 0,
- "plSection" => array("administration"),
- "plCategory" => array("winworkstation" => array("description" => _("Win workstation"),
- "objectClass" => "gotoWorkstation")),
+ return (array(
+ "plShortName" => _("Win generic"),
+ "plDescription" => _("Windows workstation generic"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 0,
+ "plSection" => array("administration"),
+ "plCategory" => array("winworkstation" => array("description" => _("Win workstation"),
+ "objectClass" => "gotoWorkstation")),
+
+ "plRequirements"=> array(
+ 'ldapSchema' => array(
+ 'posixAccount' => '',
+ 'organizationalPerson' => '',
+ 'person' => '',
+ 'inetOrgPerson' => '',
+ 'gosaAccount' => '>=2.7',
+ 'shadowAccount' => '',
+ 'sambaSamAccount' => ''
+ ),
+ 'onFailureDisablePlugin' => array(get_class())
+ ),
+
+
+ "plProperties" =>
+ array(
+ array(
+ "name" => "sambaMachineAccountRDN",
+ "type" => "rdn",
+ "default" => "ou=winstations,ou=systems,",
+ "description" => _("RDN for samba machine account storage."),
+ "check" => "gosaProperty::isRdn",
+ "migrate" => "migrate_sambaMachineAccountRDN",
+ "group" => "plugin",
+ "mandatory" => FALSE
+ )
+ ),
+
"plProvidedAcls"=> array(
"cn" => _("Name"),
"base" => _("Base"),