diff --git a/trunk/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/trunk/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index d36a32fd5370ed5b9f7d62ceda7a1548853cff79..8e1d17061b1b010df278a2b9a9aae3e0902f1ee3 100644 (file)
var $attributes= array("cn", "description", "gosaGroupObjects","member","accessTo","trustModel");
var $objectclasses= array("top", "gosaGroupOfNames");
+ var $copyMembers = TRUE;
+
function ogroup (&$config, $dn= NULL)
{
plugin::plugin ($config, $dn);
$this->used_workstations = array();
foreach($res as $og){
if($og['dn'] == $this->dn) continue;
- $test = array_intersect($ws_dns,$og['member']);
- if(($og['gosaGroupObjects'] == "[W]" || $og['gosaGroupObjects'] == "[T]") && count($test)){
+ $test = array_intersect($ws_dns,LDAP::convert($og['member']));
+ if(($og['gosaGroupObjects'][0] == "[W]" || $og['gosaGroupObjects'][0] == "[T]") && count($test)){
$this->used_workstations = array_merge($this->used_workstations,$test);
}
}
/* Add objects to group */
if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
-
+ $test = array_unique(array_intersect($this->used_workstations, $_POST['objects']));
+ if(count($test)) {
+ $str = "";
+ foreach($test as $dn) {
+ $str .= "<li>".$dn."</li>";
+ }
+ msg_dialog::display(_("Error"), sprintf(_("These systems are already configured by other object groups and cannot be added:")."<br><ul>%s</ul>", $str), ERROR_DIALOG);
+ }
$tmp = "";
foreach($this->memberList as $obj){
$tmp .= $obj['type'];
$skipped =TRUE;
}elseif(preg_match("/W/",$tmp) && $this->objects[$value]['type'] == "T"){
$skipped =TRUE;
+ }elseif(in_array($value, $this->used_workstations)) {
+ continue;
}else{
$this->memberList["$value"]= $this->objects[$value];
$this->member["$value"]= $value;
$new_dn= $this->dn;
}
- /* Check if we have workstations assigned, that are already assigned to
- another object group. */
- if ($this->gosaGroupObjects == "[W]" || $this->gosaGroupObjects == "[T]" ) {
- $test =array_intersect($this->used_workstations,$this->member);
- if(count($test)){
- $str = "";
- foreach($test as $dn){
- $str .= "<li>".$dn."</li>";
- }
- $message[] = sprintf(_("These systems are already configured by other object groups and cannot be added:")."<br><ul>%s</ul>",$str);
- }
- }
-
$ldap = $this->config->get_ldap_link();
if(LDAP::fix($this->dn) != LDAP::fix($new_dn)){
$ldap->cat ($new_dn, array('dn'));
$message[]= msgPool::required(_("Name"));
}
- if (preg_match('/[=,+<>#;]/', $this->cn)) {
- $message[] = msgPool::invalid(_("Name"), $this->cn, "/[^=+,<>#;]/");
+ if (preg_match('/[\\\\=\",+<>#;]/', $this->cn)) {
+ $message[] = msgPool::invalid(_("Name"), $this->cn, "/[^\\\\=\"+,<>#;]/");
}
/* To many different object types? */
$this->gosaGroupObjects = $source['gosaGroupObjects'][0];
}
+ if (preg_match("/[STW]/", $this->gosaGroupObjects) || !isset($source['member'])) {
+ $this->copyMembers = false;
+ } else {
+ $this->copyMembers = true;
+ }
+
/* Reload tabs */
$this->parent->reload($this->gosaGroupObjects );
{
$smarty = get_smarty();
$smarty->assign("cn", $this->cn);
+ $smarty->assign("copyMembers", $this->copyMembers);
$str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
$ret = array();
$ret['string'] = $str;
if(isset($_POST['cn'])){
$this->cn = $_POST['cn'];
}
+ if(!isset($_POST['copyMembers'])){
+ $this->member = array();
+ }
}