diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc
index 143675cd1f258bafd63c09845c1ef881f5dc9fc4..8858285e8947b7618882d8f19a783f514c52f905 100644 (file)
var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID");
var $objectclasses= array("top", "posixGroup");
+ var $CopyPasteVars = array("force_gid","fon_group","smbgroup","groupType","sambaSID","sambaDomainName","SID","nagios_group","sambaGroupType");
+
function group ($config, $dn= NULL)
{
plugin::plugin ($config, $dn);
$this->base= dn2base($ui->dn);
}
} else {
- $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
+
+ /* Get object base */
+ $this->base =preg_replace ("/^[^,]+,".normalizePreg(get_groups_ou())."/","",$this->dn);
}
/* This is always an account */
/* Base select dialog */
$once = true;
foreach($_POST as $name => $value){
- if(preg_match("/^chooseBase/",$name) && $once){
+ if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
+
$once = false;
- $this->dialog = new baseSelectDialog($this->config,$this);
+ $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
$this->dialog->setCurrentBase($this->base);
}
}
if($this->dialog->isClosed()){
$this->dialog = false;
}elseif($this->dialog->isSelected()){
- $this->base = $this->dialog->isSelected();
+
+ /* Check if selected base is valid */
+ $tmp = $this->get_allowed_bases();
+ if(isset($tmp[$this->dialog->isSelected()])){
+ $this->base = $this->dialog->isSelected();
+ }
$this->dialog= false;
}else{
return($this->dialog->execute());
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("launchimage", get_template_path('images/small_filter.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
- $smarty->assign("deplist", $this->config->idepartments);
+
+ $smarty->assign("deplist", $this->get_allowed_bases("users/user"));
$smarty->assign("alphabet", generate_alphabet());
foreach( array("dselect", "regex","SubSearchGroup") as $type){
$smarty->assign("$type", $gufilter[$type]);
return ($display);
}
- /* Bases / Departments */
- if (isset($_POST['base'])){
- $this->base= $_POST['base'];
- }
-
- $smarty->assign("bases", $this->config->idepartments);
+ $smarty->assign("bases", $this->get_allowed_bases());
$smarty->assign("base_select", $this->base);
if ($this->samba3){
/* Search in current tree or within subtrees depending on the checkbox from filter section */
if($gufilter['SubSearchGroup']){
- $ldap->search($filter, array("uid", "sn","givenName"));
+ $flag = GL_SIZELIMIT | GL_SUBSEARCH;
+ $base = $gufilter['dselect'];
}else{
- $ldap->ls ($filter, get_people_ou().$gufilter['dselect'],array("uid", "sn", "givenName"));
+ $flag = GL_SIZELIMIT ;
+ $base = get_people_ou().$gufilter['dselect'];
}
$i = 0;
-
+
+
+ $res = get_list($filter,"users",$base,array("uid", "sn", "givenName"),$flag);
+
/* Fetch all users and skip already used users */
- while($attrs = $ldap->fetch()){
+ foreach($res as $attrs){
if(in_array($attrs['uid'][0], $this->memberUid)) {
continue;
}
/* Save additional values for possible next step */
if (isset($_POST['groupedit'])){
+ /* Create a base backup and reset the
+ base directly after calling plugin::save_object();
+ Base will be set seperatly a few lines below */
+ $base_tmp = $this->base;
plugin::save_object();
+ $this->base = $base_tmp;
$this->force_gid= 0;
-
/* Only reset sambagroup flag if we are able to write this flag */
if($this->acl_is_writeable("sambaGroupType")){
$this->smbgroup = 0;
}
+ /* Get base selection */
+ if(isset($_POST['base'])){
+ $tmp = $this->get_allowed_bases();
+ if(isset($tmp[$_POST['base']])){
+ $this->base = $_POST['base'];
+ }
+ }
+
foreach (array(
"force_gid" => "gidNumber",
- "base" => "base",
"smbgroup" => "sambaGroupType") as $val => $aclname) {
if ($this->acl_is_writeable($aclname) && isset($_POST["$val"])){
$this->$val= $_POST["$val"];
$new_dn= $this->dn;
}
- if (!$this->acl_is_createable()){
- $message[]= _("You have no permissions to create a group on this 'Base'.");
- }
-
/* must: cn */
if ($this->cn == "" && $this->acl_is_writeable("cn")){
$message[]= "The required field 'Name' is not set.";
}
/* Find out next free id near to UID_BASE */
- for ($id= $this->config->current['UIDBASE']; $id++; $id<65000){
+ for ($id= $this->config->current['UIDBASE']; $id++; $id < pow(2,32)){
if (!in_array($id, $ids)){
return ($id);
}
}
- /* Should not happen */
- if ($id == 65000){
+ /* Check if id reached maximum */
+ if ($id >= pow(2,32)){
print_red(_("Too many users, can't allocate a free ID!"));
exit;
}
"plProvidedAcls" => array(
"cn" => _("Name"),
- "description" => _("Description"),
"base" => _("Base"),
+ "description" => _("Description"),
- "fonGroup" => _("Phone pickup group"),
- "nagiosGroup" => _("Nagios group"),
+ "fonGroup" => _("Phone pickup group"),
+ "nagiosGroup" => _("Nagios group"),
"gidNumber" => _("GID"),
"memberUid" => _("Group member"),