diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index bdfd1f08b2ee70fcb9f14b164bb8544bd5e22733..dd4f7146e1cc22950415d4ebde4c23703eac5009 100644 (file)
var $was_trust_account= FALSE;
+ /* Already assigned Workstations. Will be hidden in selection.
+ */
+ var $used_workstations = array();
+
/* attribute list for save action */
var $attributes= array("cn", "description", "gosaGroupObjects","member","accessTo","trustModel");
var $objectclasses= array("top", "gosaGroupOfNames");
}
}
+ /* Detect all workstations, which are already assigned to an object group
+ - Those objects will be hidden in the add object dialog.
+ - Check() will complain if such a system is assigned to this object group.
+ */
+ $base = $this->config->current['BASE'];
+ $res = get_list("(objectClass=gotoWorkstation)","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);
+ $this->used_workstations = array();
+ foreach($res as $og){
+ if($og['dn'] == $this->dn) continue;
+ $test = array_intersect($ws_dns,$og['member']);
+ if(count($test)){
+ $this->used_workstations = array_merge($this->used_workstations,$test);
+ }
+ }
+
$this->orig_cn = $this->cn;
$this->orig_base = $this->base;
+ /* Get global filter config */
+ if (!session::is_set("sysfilter")){
+ $ui= get_userinfo();
+ $base= get_base_from_people($ui->dn);
+ $sysfilter= array( "depselect" => $base,
+ "regex" => "*");
+ session::set("sysfilter", $sysfilter);
+ }
+
/* Load member data */
$this->reload();
}
$regex= $sysfilter['regex'];
$filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
- $deps_a = array(get_ou("serverou"),
- get_ou("terminalou"),
- get_ou("workstationou"));
- $res= get_sub_list($filter, array("terminal","server","workstation"), $deps_a, get_ou("systemsou").$sysfilter['depselect'],
+ $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){
"departments" => array("OBJ"=>"department", "CLASS"=>"gosaDepartment" ,
"DN"=> "" ,"ACL" => "department"),
"servers" => array("OBJ"=>"servgeneric", "CLASS"=>"goServer" ,
- "DN"=> get_ou('serverou') ,"ACL" => "server"),
+ "DN"=> get_ou('serverRDN') ,"ACL" => "server"),
"workstations" => array("OBJ"=>"workgeneric", "CLASS"=>"gotoWorkstation",
- "DN"=> get_ou('workstationou') ,"ACL" => "workstation"),
+ "DN"=> get_ou('workstationRDN') ,"ACL" => "workstation"),
"winstations" => array("OBJ"=>"wingeneric", "CLASS"=>"opsiClient",
- "DN"=> get_ou('WINSTATIONS') ,"ACL" => "winstation"),
+ "DN"=> get_ou('SAMBAMACHINEACCOUNTRDN') ,"ACL" => "winstation"),
"terminals" => array("OBJ"=>"termgeneric", "CLASS"=>"gotoTerminal" ,
- "DN"=> get_ou('terminalou') ,"ACL" => "terminal"),
+ "DN"=> get_ou('terminalRDN') ,"ACL" => "terminal"),
"printers" => array("OBJ"=>"printgeneric", "CLASS"=>"gotoPrinter" ,
- "DN"=> get_ou('printerou') ,"ACL" => "printer"),
+ "DN"=> get_ou('printerRDN') ,"ACL" => "printer"),
"phones" => array("OBJ"=>"phoneGeneric", "CLASS"=>"goFonHardware" ,
- "DN"=> get_ou('phoneou') ,"ACL" => "phone"));
+ "DN"=> get_ou('phoneRDN') ,"ACL" => "phone"));
/* Allow searching for applications, if we are not using release managed applications
/* fetch results and append them to the list */
foreach($res as $attrs){
+ /* Skip workstations which are already assigned to an object group.
+ */
+ if(in_array($attrs['dn'],$this->used_workstations)){
+ continue;
+ }
+
$type= $this->getObjectType($attrs);
$name= $this->getObjectName($attrs);
function convert_list($input)
{
$temp= "";
- $conv= array( "U" => "select_user.png",
+ $conv= array(
+ "U" => "plugins/generic/images/head.png",
"G" => "plugins/groups/images/groups.png",
"A" => "plugins/ogroups/images/application.png",
"D" => "plugins/departments/images/department.png",
$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;
+ }
+ }
+# $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();
if($this->dn != $new_dn){
*/
if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
$message[] = msgPool::permCreate();
- }elseif($this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
+ }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
$message[] = msgPool::permMove();
}
"cn" => _("Name"),
"base" => _("Base"),
"description" => _("Description"),
+ "trustModel" => _("Sytem trust"),
"member" => _("Member"))
));
}