summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 55828ee)
raw | patch | inline | side by side (parent: 55828ee)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 2 Sep 2008 08:49:16 +0000 (08:49 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 2 Sep 2008 08:49:16 +0000 (08:49 +0000) |
-It s no longer possible to add a workstation to more than one object group.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12339 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12339 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/admin/ogroups/class_ogroup.inc | patch | blob | history |
diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index 029feeb1730ec1fae99dcd70ba463fce68d27fe0..497183659bfa9210504bbcc1ec611415001becc6 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;
/* 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);
$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){