index 32dba79b58effb0c53484e0c5f72721120256745..3b7751fc7fe420296b99b1d888344967c9a9a654 100644 (file)
}
}
register_global("ogfilter", $ogfilter);
+
+ if(isset($_SESSION['ogroupfilter']['depselect'])){
+ $this->base = $_SESSION['ogroupfilter']['depselect'];
+ }
+
+ /* set permissions */
+ $ui= get_userinfo();
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $this->acl= get_module_permission($acl, "ogroup", $ui->dn);
+
/* Load member data */
$this->reload();
}
- function execute()
- {
- /* Do we represent a valid group? */
- if (!$this->is_account){
- $display= "<img src=\"images/stop.png\" align=center> <b>".
- _("This 'dn' is no object group.")."</b>";
- return ($display);
- }
-
-
-
- /* Delete objects from group */
+ function AddDelMembership(){
+ /* Delete objects from group */
if (isset($_POST['delete_membership']) && isset($_POST['members'])){
foreach ($_POST['members'] as $value){
$this->objects["$value"]= $this->memberList[$value];
}
$this->reload();
}
+ }
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ $this->reload();
+
+ /* Do we represent a valid group? */
+ if (!$this->is_account){
+ $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
+ _("This 'dn' is no object group.")."</b>";
+ return ($display);
+ }
+
+ /* Delete objects from group */
+ if (isset($_POST['delete_membership']) && isset($_POST['members'])){
+ foreach ($_POST['members'] as $value){
+ if(isset($this->memberList[$value])){
+ $this->objects["$value"]= $this->memberList[$value];
+ unset ($this->memberList["$value"]);
+ unset ($this->member["$value"]);
+ uasort ($this->objects, 'sort_list');
+ reset ($this->objects);
+ }
+ }
+ $this->reload();
+ }
+
+ /* Add objects to group */
+ if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
+ foreach ($_POST['objects'] as $value){
+ if(isset($this->objects[$value])){
+ $this->memberList["$value"]= $this->objects[$value];
+ $this->member["$value"]= $value;
+ unset ($this->objects[$value]);
+ uasort ($this->memberList, 'sort_list');
+ reset ($this->memberList);
+ }
+ }
+ $this->reload();
+ }
/* Load templating engine */
$smarty= get_smarty();
}
/* Bases / Departments */
- if ($this->dn == "new"){
- $ui= get_userinfo();
- $this->base= dn2base($ui->dn);
- } else {
+
if (isset($_POST['base'])){
$this->base= $_POST['base'];
- } else {
- $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
}
- }
/* Assemble combine string */
if ($this->gosaGroupObjects == "[]"){
} else {
$this->allobjects[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
}
+ $this->allobjects[$attrs["dn"]]['objectClass'] = $attrs['objectClass'];
+ if(isset($attrs['uid'])){
+ $this->allobjects[$attrs["dn"]]['uid'] = $attrs['uid'];
+ }
}
uasort ($this->allobjects, 'sort_list');
reset ($this->allobjects);
$new_dn= $this->dn;
}
+
+ $ldap = $this->config->get_ldap_link();
+ if($this->dn != $new_dn){
+ $ldap->cat ($new_dn);
+ }
+
+ if($ldap->count() !=0){
+ $message[]= _("There is already an object with this cn.");
+ }
+
$ui= get_userinfo();
$acl= get_permissions ($new_dn, $ui->subtreeACL);
$acl= get_module_permission($acl, "group", $new_dn);
$message[]= "The required field 'Name' is not set.";
}
- /* Need at least one member */
- if (count($this->member) == 0){
- $message[]= _("Object groups need at least one member!");
- }
-
/* To many different object types? */
if (strlen($this->gosaGroupObjects) > 4){
$message[]= _("You can combine two different object types at maximum only!");