diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index dd4f7146e1cc22950415d4ebde4c23703eac5009..40f8bc600eb55fca13fe736a481c38df301b5a01 100644 (file)
var $description= "";
var $base= "";
var $gosaGroupObjects= "";
var $description= "";
var $base= "";
var $gosaGroupObjects= "";
- var $department= "";
var $objects= array();
var $objcache= array();
var $memberList= array();
var $objects= array();
var $objcache= array();
var $memberList= array();
var $orig_dn= "";
var $orig_cn= "";
var $orig_base= "";
var $orig_dn= "";
var $orig_cn= "";
var $orig_base= "";
- var $group_dialog= FALSE;
+ var $objectSelect= FALSE;
var $view_logged = FALSE;
var $accessTo= array();
var $trustModel= "";
var $view_logged = FALSE;
var $accessTo= array();
var $trustModel= "";
- var $show_ws_dialog = FALSE;
+ var $trustSelect = FALSE;
var $was_trust_account= FALSE;
var $was_trust_account= FALSE;
+ var $baseSelector;
/* Already assigned Workstations. Will be hidden in selection.
*/
/* Already assigned Workstations. Will be hidden in selection.
*/
}
$this->is_account= TRUE;
}
$this->is_account= TRUE;
- /* Get global filter config */
- if (!session::is_set("ogfilter")){
- $ui= get_userinfo();
- $base= get_base_from_people($ui->dn);
- $ogfilter= array( "dselect" => $base,
- "regex" => "*");
- session::set("ogfilter", $ogfilter);
- }
- $ogfilter= session::get('ogfilter');
-
- /* Adjust flags */
- foreach( array( "U" => "accounts",
- "G" => "groups",
- "A" => "applications",
- "D" => "departments",
- "S" => "servers",
- "W" => "workstations",
- "O" => "winstations",
- "T" => "terminals",
- "F" => "phones",
- "_" => "subtrees",
- "P" => "printers") as $key => $val){
-
- if (preg_match("/$key/", $this->gosaGroupObjects)){
- $ogfilter[$val]= "checked";
- } else {
- $ogfilter[$val]= "";
- }
- }
- session::set("ogfilter", $ogfilter);
-
- if(session::is_set('CurrentMainBase')){
- $this->base = session::get('CurrentMainBase');
- }
-
/* Set base */
if ($this->dn == "new"){
/* Set base */
if ($this->dn == "new"){
- $this->base = session::get('CurrentMainBase');
+ $ui = get_userinfo();
+ $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
} else {
} else {
- $this->base= preg_replace("/^[^,]+,".normalizePreg(get_ou("ogroupou"))."/","",$this->dn);
+ $this->base= preg_replace("/^[^,]+,".preg_quote(get_ou("ogroupRDN"), '/')."/i","",$this->dn);
/* Is this account a trustAccount? */
if ($this->is_account && isset($this->attrs['trustModel'])){
/* Is this account a trustAccount? */
if ($this->is_account && isset($this->attrs['trustModel'])){
- Check() will complain if such a system is assigned to this object group.
*/
$base = $this->config->current['BASE'];
- Check() will complain if such a system is assigned to this object group.
*/
$base = $this->config->current['BASE'];
- $res = get_list("(objectClass=gotoWorkstation)","none" ,
+ $res = get_list("(|(objectClass=gotoWorkstation)(objectClass=gotoTerminal))","none" ,
$base, array("dn"),GL_NO_ACL_CHECK|GL_SUBSEARCH);
$ws_dns = array();
foreach($res as $data){
$ws_dns[] = $data['dn'];
}
$res=get_list("(&(member=*)(objectClass=gosaGroupOfNames))","none",
$base, array("dn"),GL_NO_ACL_CHECK|GL_SUBSEARCH);
$ws_dns = array();
foreach($res as $data){
$ws_dns[] = $data['dn'];
}
$res=get_list("(&(member=*)(objectClass=gosaGroupOfNames))","none",
- $base, array("dn","member"),GL_NO_ACL_CHECK|GL_SUBSEARCH);
+ $base, array("dn","member", "gosaGroupObjects"),GL_NO_ACL_CHECK|GL_SUBSEARCH);
$this->used_workstations = array();
foreach($res as $og){
if($og['dn'] == $this->dn) continue;
$test = array_intersect($ws_dns,$og['member']);
$this->used_workstations = array();
foreach($res as $og){
if($og['dn'] == $this->dn) continue;
$test = array_intersect($ws_dns,$og['member']);
- if(count($test)){
+ if(($og['gosaGroupObjects'] == "[W]" || $og['gosaGroupObjects'] == "[T]") && count($test)){
$this->used_workstations = array_merge($this->used_workstations,$test);
}
}
$this->used_workstations = array_merge($this->used_workstations,$test);
}
}
session::set("sysfilter", $sysfilter);
}
session::set("sysfilter", $sysfilter);
}
- /* Load member data */
+ /* Instanciate base selector */
+ $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
+ $this->baseSelector->setSubmitButton(false);
+ $this->baseSelector->setHeight(300);
+ $this->baseSelector->update(true);
+
$this->reload();
}
$this->reload();
}
/* Add member and force reload */
$this->member[$NewMember]= $NewMember;
/* Add member and force reload */
$this->member[$NewMember]= $NewMember;
- $this->reload();
$this->memberList[$NewMember]= $this->objcache[$NewMember];
unset ($this->objects[$NewMember]);
uasort ($this->memberList, 'sort_list');
reset ($this->memberList);
$this->memberList[$NewMember]= $this->objcache[$NewMember];
unset ($this->objects[$NewMember]);
uasort ($this->memberList, 'sort_list');
reset ($this->memberList);
+ $this->reload();
}else{
/* Delete objects from group */
if (isset($_POST['delete_membership']) && isset($_POST['members'])){
}else{
/* Delete objects from group */
if (isset($_POST['delete_membership']) && isset($_POST['members'])){
}
/* Add objects to group */
}
/* Add objects to group */
- if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
-
- $tmp = "";
- foreach($this->memberList as $obj){
- $tmp .= $obj['type'];
- }
+ if (isset($_POST['objectSelect_save']) && $this->objectSelect instanceOf objectSelect){
+ $objects = $this->objectSelect->save();
$skipped = FALSE;
$skipped = FALSE;
- foreach ($_POST['objects'] as $value){
- if(preg_match("/T/",$tmp) && $this->objects[$value]['type'] == "W"){
+ foreach($objects as $object){
+
+ $tmp = "";
+ foreach($this->memberList as $obj){
+ $tmp .= $obj['type'];
+ }
+
+ $type = $this->getObjectType($object);
+ $name= $this->getObjectName($object);
+ $dn = $object['dn'];
+
+ /* Fill array */
+ if (isset($object["description"][0])){
+ $object= array("text" => "$name [".$object["description"][0]."]", "type" => "$type");
+ } elseif (isset($object["uid"][0])) {
+ $object= array("text" => "$name [".$object["uid"][0]."]", "type" => "$type");
+ } else {
+ $object= array("text" => "$name", "type" => "$type");
+ }
+
+ if(preg_match("/T/",$tmp) && $type == "W"){
$skipped =TRUE;
$skipped =TRUE;
- }elseif(preg_match("/W/",$tmp) && $this->objects[$value]['type'] == "T"){
+ }elseif(preg_match("/W/",$tmp) && $type == "T"){
$skipped =TRUE;
}else{
$skipped =TRUE;
}else{
- $this->memberList["$value"]= $this->objects[$value];
- $this->member["$value"]= $value;
- unset ($this->objects[$value]);
+
+ $this->memberList["$dn"]= $object;
+ $this->member["$dn"]= $dn;
uasort ($this->memberList, 'sort_list');
reset ($this->memberList);
}
uasort ($this->memberList, 'sort_list');
reset ($this->memberList);
}
if($skipped){
msg_dialog::display(_("Information"), _("You cannot combine terminals and workstations in one object group!"), INFO_DIALOG);
}
if($skipped){
msg_dialog::display(_("Information"), _("You cannot combine terminals and workstations in one object group!"), INFO_DIALOG);
}
+ $this->objectSelect= FALSE;
+ $this->dialog= FALSE;
$this->reload();
}
}
$this->reload();
}
}
/* Load templating engine */
$smarty= get_smarty();
/* Load templating engine */
$smarty= get_smarty();
+ $smarty->assign("usePrototype", "true");
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $name => $translation){
$smarty->assign($name."ACL",$this->getacl($name));
}
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $name => $translation){
$smarty->assign($name."ACL",$this->getacl($name));
}
- /* Base select dialog */
- $once = true;
- foreach($_POST as $name => $value){
- if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
- $once = false;
- $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
- $this->dialog->setCurrentBase($this->base);
- }
- }
-
/***********
* Trusts
***********/
/* Add user workstation? */
if (isset($_POST["add_ws"])){
/***********
* Trusts
***********/
/* Add user workstation? */
if (isset($_POST["add_ws"])){
- $this->show_ws_dialog= TRUE;
+ $this->trustSelect= new trustSelect($this->config,get_userinfo());
$this->dialog= TRUE;
}
$this->dialog= TRUE;
}
- /* Add user workstation? */
- if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
- foreach($_POST['wslist'] as $ws){
- $this->accessTo[$ws]= $ws;
+ // Add selected machines to trusted ones.
+ if (isset($_POST["add_ws_finish"]) && $this->trustSelect){
+ $trusts = $this->trustSelect->detectPostActions();
+ if(isset($trusts['targets'])){
+
+ $headpage = $this->trustSelect->getHeadpage();
+ foreach($trusts['targets'] as $id){
+ $attrs = $headpage->getEntry($id);
+ $this->accessTo[$attrs['cn'][0]]= $attrs['cn'][0];
+ }
+ ksort($this->accessTo);
+ $this->is_modified= TRUE;
}
}
- ksort($this->accessTo);
- $this->is_modified= TRUE;
+ $this->trustSelect= NULL;
+ $this->dialog= FALSE;
}
}
+
/* Remove user workstations? */
if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
foreach($_POST['workstation_list'] as $name){
/* Remove user workstations? */
if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
foreach($_POST['workstation_list'] as $name){
}
/* Add user workstation finished? */
}
/* Add user workstation finished? */
- if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
- $this->show_ws_dialog= FALSE;
+ if (isset($_POST["add_ws_cancel"])){
+ $this->trustSelect= NULL;
$this->dialog= FALSE;
}
/* Show ws dialog */
$this->dialog= FALSE;
}
/* Show ws dialog */
- if ($this->show_ws_dialog){
- /* Save data */
- $sysfilter= session::get("sysfilter");
- foreach( array("depselect", "regex") as $type){
- if (isset($_POST[$type])){
- $sysfilter[$type]= $_POST[$type];
- }
- }
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $sysfilter['regex']= $s;
- }
- session::set("sysfilter", $sysfilter);
-
- /* Get workstation list */
- $exclude= "";
- foreach($this->accessTo as $ws){
- $exclude.= "(cn=$ws)";
- }
- if ($exclude != ""){
- $exclude= "(!(|$exclude))";
- }
- $regex= $sysfilter['regex'];
- $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
-
- $deps_a = array(get_ou("serverRDN"),
- get_ou("terminalRDN"),
- get_ou("workstationRDN"));
- $res= get_sub_list($filter, array("terminal","server","workstation"), $deps_a, get_ou("systemRDN").$sysfilter['depselect'],
- array("cn"), GL_SUBSEARCH | GL_SIZELIMIT);
- $wslist= array();
- foreach ($res as $attrs){
- $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]);
- }
- asort($wslist);
- $smarty->assign("search_image", get_template_path('images/lists/search.png'));
- $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
- $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
- $smarty->assign("deplist", $this->config->idepartments);
- $smarty->assign("alphabet", generate_alphabet());
- foreach( array("depselect", "regex") as $type){
- $smarty->assign("$type", $sysfilter[$type]);
- }
- $smarty->assign("hint", print_sizelimit_warning());
- $smarty->assign("wslist", $wslist);
- $smarty->assign("apply", apply_filter());
- $display= $smarty->fetch (get_template_path('trust_machines.tpl', TRUE, dirname(__FILE__)));
- return ($display);
+ if ($this->trustSelect){
+
+ // Build up blocklist
+ session::set('filterBlacklist', array('cn' => array_values($this->accessTo)));
+ return($this->trustSelect->execute());
}
/***********
}
/***********
/* Add objects? */
if (isset($_POST["edit_membership"])){
/* Add objects? */
if (isset($_POST["edit_membership"])){
- $this->group_dialog= TRUE;
+ $this->objectSelect= new objectSelect($this->config, get_userinfo());
$this->dialog= TRUE;
}
/* Add objects finished? */
$this->dialog= TRUE;
}
/* Add objects finished? */
- if (isset($_POST["add_object_finish"]) || isset($_POST["add_object_cancel"])){
- $this->group_dialog= FALSE;
+ if (isset($_POST["objectSelect_cancel"])){
+ $this->objectSelect= FALSE;
$this->dialog= FALSE;
}
/* Manage object add dialog */
$this->dialog= FALSE;
}
/* Manage object add dialog */
- if ($this->group_dialog){
-
- /* Save data */
- $ogfilter= session::get("ogfilter");
- foreach( array("dselect", "regex") as $type){
- if (isset($_POST[$type])){
- $ogfilter[$type]= $_POST[$type];
- }
- }
- if (isset($_POST['dselect'])){
- foreach( array("accounts", "groups", "applications", "departments",
- "servers", "workstations", "winstations", "terminals", "printers","subtrees",
- "phones") as $type){
-
- if (isset($_POST[$type])) {
- $ogfilter[$type]= "checked";
- } else {
- $ogfilter[$type]= "";
- }
- }
- }
- if (isset($_GET['search'])){
- $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
- if ($s == "**"){
- $s= "*";
- }
- $ogfilter['regex']= $s;
- }
- session::set("ogfilter", $ogfilter);
- $this->reload();
-
- /* Calculate actual groups */
- $smarty->assign("objects", $this->convert_list($this->objects));
-
- /* Show dialog */
- $smarty->assign("search_image", get_template_path('images/lists/search.png'));
- $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
- $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
- $smarty->assign("deplist", $this->config->idepartments);
- $smarty->assign("alphabet", generate_alphabet());
- foreach( array("dselect", "regex", "subtrees") as $type){
- $smarty->assign("$type", $ogfilter[$type]);
- }
- $smarty->assign("hint", print_sizelimit_warning());
- $smarty->assign("apply", apply_filter());
-
- /* Build up checkboxes
- */
- $ar = array(
- "departments" => array(
- "T" => msgPool::selectToView(_("departments")),
- "C" => (isset($ogfilter['departments']) && ($ogfilter['departments'])),
- "L" => sprintf(_("Show %s"),_("departments"))),
- "accounts" => array(
- "T" => msgPool::selectToView(_("people")),
- "C" => (isset($ogfilter['accounts']) && ($ogfilter['accounts'])),
- "L" => sprintf(_("Show %s"),_("people"))),
- "groups"=> array(
- "T" => msgPool::selectToView(_("groups")),
- "C" => (isset($ogfilter['groups']) && ($ogfilter['groups'])),
- "L" => sprintf(_("Show %s"),_("groups"))),
- "servers"=> array(
- "T" => msgPool::selectToView(_("servers")),
- "C" => (isset($ogfilter['servers']) && ($ogfilter['servers'])),
- "L" => sprintf(_("Show %s"),_("servers"))),
- "workstations"=> array(
- "T" => msgPool::selectToView(_("workstations")),
- "C" => (isset($ogfilter['workstations']) && ($ogfilter['workstations'])),
- "L" => sprintf(_("Show %s"),_("workstations"))),
- "terminals"=> array(
- "T" => msgPool::selectToView(_("terminals")),
- "C" => (isset($ogfilter['terminals']) && ($ogfilter['terminals'])),
- "L" => sprintf(_("Show %s"),_("terminals"))),
- "printers"=> array(
- "T" => msgPool::selectToView(_("printer")),
- "C" => (isset($ogfilter['printers']) && ($ogfilter['printers'])),
- "L" => sprintf(_("Show %s"),_("printers"))),
- "phones"=> array(
- "T" => msgPool::selectToView(_("phones")),
- "C" => (isset($ogfilter['phones']) && ($ogfilter['phones'])),
- "L" => sprintf(_("Show %s"),_("phones"))));
-
- /* Allow selecting applications if we are having a non
- release managed application storage */
- if(!$this->IsReleaseManagementActivated()){
- $ar["applications"] = array(
- "T" => msgPool::selectToView(_("applications")),
- "C" => (isset($ogfilter['applications']) && ($ogfilter['applications'])),
- "L" => sprintf(_("Show %s"),_("applications")));
- }
-
- $smarty->assign("checkboxes",$ar);
- $display= $smarty->fetch (get_template_path('ogroup_objects.tpl', TRUE, dirname(__FILE__)));
- return ($display);
+ if ($this->objectSelect){
+ session::set('filterBlacklist', array('dn'=> $this->member));
+ return($this->objectSelect->execute());
}
/* Bases / Departments */
}
/* Bases / Departments */
}
/* Assign variables */
}
/* Assign variables */
- $smarty->assign("bases", $this->get_allowed_bases());
- $smarty->assign("base_select", $this->base);
- $smarty->assign("department", $this->department);
+ $smarty->assign("base", $this->baseSelector->render());
$smarty->assign("members", $this->convert_list($this->memberList));
/* Objects have to be tuned... */
$smarty->assign("members", $this->convert_list($this->memberList));
/* Objects have to be tuned... */
plugin::save_object();
$this->base = $base_tmp;
plugin::save_object();
$this->base = $base_tmp;
- /* Save base, since this is no LDAP attribute */
- $tmp = $this->get_allowed_bases();
- if(isset($_POST['base'])){
- if(isset($tmp[$_POST['base']])){
- $this->base= $_POST['base'];
+ /* Refresh base */
+ if ($this->acl_is_moveable($this->base)){
+ if (!$this->baseSelector->update()) {
+ msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+ }
+ if ($this->base != $this->baseSelector->getBase()) {
+ $this->base= $this->baseSelector->getBase();
+ $this->is_modified= TRUE;
}
}
}
}
+
}
}
}
}
$p_f= array("accounts"=> array("OBJ"=>"user", "CLASS"=>"gosaAccount" ,
"DN"=> get_people_ou() ,"ACL" => "users"),
"groups" => array("OBJ"=>"group", "CLASS"=>"posixGroup" ,
$p_f= array("accounts"=> array("OBJ"=>"user", "CLASS"=>"gosaAccount" ,
"DN"=> get_people_ou() ,"ACL" => "users"),
"groups" => array("OBJ"=>"group", "CLASS"=>"posixGroup" ,
- "DN"=> get_groups_ou('ogroupou') ,"ACL" => "groups"),
+ "DN"=> get_groups_ou('ogroupRDN') ,"ACL" => "groups"),
"departments" => array("OBJ"=>"department", "CLASS"=>"gosaDepartment" ,
"DN"=> "" ,"ACL" => "department"),
"servers" => array("OBJ"=>"servgeneric", "CLASS"=>"goServer" ,
"departments" => array("OBJ"=>"department", "CLASS"=>"gosaDepartment" ,
"DN"=> "" ,"ACL" => "department"),
"servers" => array("OBJ"=>"servgeneric", "CLASS"=>"goServer" ,
*/
if(!$this->IsReleaseManagementActivated()){
$p_f[ "applications"] = array("OBJ"=>"application", "CLASS"=>"gosaApplication",
*/
if(!$this->IsReleaseManagementActivated()){
$p_f[ "applications"] = array("OBJ"=>"application", "CLASS"=>"gosaApplication",
- "DN"=> get_ou('applicationou') ,"ACL" => "application");
+ "DN"=> get_ou('applicationRDN') ,"ACL" => "application");
}
/*###########
}
/*###########
/* Skip workstations which are already assigned to an object group.
*/
/* Skip workstations which are already assigned to an object group.
*/
- if(in_array($attrs['dn'],$this->used_workstations)){
- continue;
+ if ($this->gosaGroupObjects == "[W]" || $this->gosaGroupObjects == "[T]"){
+ if(in_array($attrs['dn'],$this->used_workstations)){
+ continue;
+ }
}
$type= $this->getObjectType($attrs);
}
$type= $this->getObjectType($attrs);
/* It has failed, add entry with type flag I (Invalid)*/
if (!$ldap->success()){
/* It has failed, add entry with type flag I (Invalid)*/
if (!$ldap->success()){
- $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".@LDAP::fix($dn),"type" => "I");
+ $this->memberList[$dn]= array('text' => _("Non existing dn:")." ".LDAP::fix($dn),"type" => "I");
} else {
} else {
{
$temp= "";
$conv= array(
{
$temp= "";
$conv= array(
+ "Y" => "plugins/users/images/select_template.png",
"U" => "plugins/generic/images/head.png",
"U" => "plugins/generic/images/head.png",
- "G" => "plugins/groups/images/groups.png",
+ "G" => "plugins/groups/images/select_group.png",
"A" => "plugins/ogroups/images/application.png",
"D" => "plugins/departments/images/department.png",
"S" => "plugins/ogroups/images/server.png",
"A" => "plugins/ogroups/images/application.png",
"D" => "plugins/departments/images/department.png",
"S" => "plugins/ogroups/images/server.png",
"O" => "plugins/ogroups/images/winstation.png",
"T" => "plugins/ogroups/images/terminal.png",
"F" => "plugins/ogroups/images/phone.png",
"O" => "plugins/ogroups/images/winstation.png",
"T" => "plugins/ogroups/images/terminal.png",
"F" => "plugins/ogroups/images/phone.png",
- "I" => "images/lists/flag.png",
- "P" => "plugins/ogroups/images/printer.png");
+ "P" => "plugins/ogroups/images/printer.png",
+ "I" => "images/false.png");
foreach ($input as $key => $value){
/* Generate output */
foreach ($input as $key => $value){
/* Generate output */
{
$type= "I";
{
$type= "I";
- foreach(array( "U" => "gosaAccount",
+ foreach(array(
+ "Y" => "gosaUserTemplate",
+ "U" => "gosaAccount",
"G" => "posixGroup",
"A" => "gosaApplication",
"D" => "gosaDepartment",
"G" => "posixGroup",
"A" => "gosaApplication",
"D" => "gosaDepartment",
/* Permissions for that base? */
if ($this->base != ""){
/* Permissions for that base? */
if ($this->base != ""){
- $new_dn= 'cn='.$this->cn.','.get_ou('ogroupou').$this->base;
+ $new_dn= 'cn='.$this->cn.','.get_ou('ogroupRDN').$this->base;
} else {
$new_dn= $this->dn;
}
/* Check if we have workstations assigned, that are already assigned to
} else {
$new_dn= $this->dn;
}
/* Check if we have workstations assigned, that are already assigned to
- another object group.
- */
- $test =array_intersect($this->used_workstations,$this->member);
- if(count($test)){
- $str = "";
- $cnt = 0;
- foreach($test as $dn){
- $str .= $dn.", ";
- $cnt ++;
- if($cnt > 2){
- $str .= "...";
- break;
+ 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);
}
}
-# $message[] = sprintf(_("The following workstations are already member in another object group and can not be added: '%s'"),$str);
}
$ldap = $this->config->get_ldap_link();
}
$ldap = $this->config->get_ldap_link();
- if($this->dn != $new_dn){
+ if(LDAP::fix($this->dn) != LDAP::fix($new_dn)){
$ldap->cat ($new_dn, array('dn'));
}
$ldap->cat ($new_dn, array('dn'));
}
$message[]= msgPool::duplicated(_("Name"));
}
$message[]= msgPool::duplicated(_("Name"));
}
+ // Check if a wrong base was supplied
+ if(!$this->baseSelector->checkLastBaseUpdate()){
+ $message[]= msgPool::check_base();;
+ }
+
/* Set new acl base */
if($this->dn == "new") {
$this->set_acl_base($this->base);
/* Set new acl base */
if($this->dn == "new") {
$this->set_acl_base($this->base);
$message[]= msgPool::required(_("Name"));
}
$message[]= msgPool::required(_("Name"));
}
+ if (preg_match('/[=,+<>#;]/', $this->cn)) {
+ $message[] = msgPool::invalid(_("Name"), $this->cn, "/[^=+,<>#;]/");
+ }
+
/* To many different object types? */
if (strlen($this->gosaGroupObjects) > 4){
$message[]= _("You can combine two different object types at maximum, only!");
/* To many different object types? */
if (strlen($this->gosaGroupObjects) > 4){
$message[]= _("You can combine two different object types at maximum, only!");
/* Move members to target array */
$this->attrs['member'] =array();
foreach ($this->member as $key => $desc){
/* Move members to target array */
$this->attrs['member'] =array();
foreach ($this->member as $key => $desc){
- $this->attrs['member'][]= @LDAP::fix($key);
+ $this->attrs['member'][]= LDAP::fix($key);
}
$ldap= $this->config->get_ldap_link();
/* New accounts need proper 'dn', propagate it to remaining objects */
if ($this->dn == 'new'){
}
$ldap= $this->config->get_ldap_link();
/* New accounts need proper 'dn', propagate it to remaining objects */
if ($this->dn == 'new'){
- $this->dn= 'cn='.$this->cn.','.get_ou('ogroupou').$this->base;
+ $this->dn= 'cn='.$this->cn.','.get_ou('ogroupRDN').$this->base;
}
/* Save data. Using 'modify' implies that the entry is already present, use 'add' for
}
/* Save data. Using 'modify' implies that the entry is already present, use 'add' for
function PrepareForCopyPaste($source)
{
function PrepareForCopyPaste($source)
{
- /* Update available object types */
- if(isset($source['gosaGroupObjects'][0])){
- $this->gosaGroupObjects = $source['gosaGroupObjects'][0];
- }
+ plugin::PrepareForCopyPaste($source);
/* Reload tabs */
$this->parent->reload($this->gosaGroupObjects );
/* Reload tabs */
$this->parent->reload($this->gosaGroupObjects );
}
}
}
}
- /* Load member objects */
- if (isset($source['member'])){
- foreach ($source['member'] as $key => $value){
- if ("$key" != "count"){
- $value= @LDAP::convert($value);
- $this->member["$value"]= "$value";
- }
- }
+ $source_o = new ogroup ($this->config, $source['dn']);
+ foreach(array("accessTo","member","gosaGroupObjects") as $attr){
+ $this->$attr = $source_o->$attr;
}
}
-
}
}