diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc
index 5d32a551b7f14ccb78b1fe012eb926907bac5774..dba7c496a53745fb9410f59249b686eb368ce143 100644 (file)
<?php
<?php
+
class group extends plugin
{
/* CLI vars */
class group extends plugin
{
/* CLI vars */
var $allowGroupsWithSameNameInOtherSubtrees = true;
var $allowGroupsWithSameNameInOtherSubtrees = true;
+ var $CopyPasteVars = array("force_gid","fon_group","smbgroup","groupType","sambaSID","sambaDomainName","SID","nagios_group","sambaGroupType");
+
/* attribute list for save action */
var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID");
var $objectclasses= array("top", "posixGroup");
/* attribute list for save action */
var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID");
var $objectclasses= array("top", "posixGroup");
- function group ($config, $dn= NULL)
+ function group ($config, $dn= NULL, $parent= NULL)
{
{
- plugin::plugin ($config, $dn);
+ plugin::plugin ($config, $dn, $parent);
/* Load attributes depending on the samba version */
$this->samba3= ($config->current['SAMBAVERSION'] == 3);
/* Load attributes depending on the samba version */
$this->samba3= ($config->current['SAMBAVERSION'] == 3);
$this->base= dn2base($ui->dn);
}
} else {
$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 */
}
/* This is always an account */
}
}
if(!empty($filter)){
}
}
if(!empty($filter)){
+ $ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|".$filter."))",array("uid","sn","givenName"));
while($attrs = $ldap->fetch()){
$this->members[$attrs['uid'][0]] = $this->createResultName($attrs);
$ldap->search("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(|".$filter."))",array("uid","sn","givenName"));
while($attrs = $ldap->fetch()){
$this->members[$attrs['uid'][0]] = $this->createResultName($attrs);
/* Create display list of users matching regex & filter
*/
$this->displayUsers = array();
/* Create display list of users matching regex & filter
*/
$this->displayUsers = array();
- $filter = "(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))";
+
+ /* Set tag attribute if we've tagging activated */
+ $tag= "";
+ $ui= get_userinfo();
+ if ($ui->gosaUnitTag != "" && isset($this->config->current['STRICT_UNITS']) &&
+ preg_match('/TRUE/i', $this->config->current['STRICT_UNITS'])){
+ $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
+ }
+
+ $filter = "(&(objectClass=gosaAccount)$tag(!(objectClass=gosaUserTemplate))(!(uid=*$))(|(uid=".$regex.")(sn=".$regex.")(givenName=".$regex.")))";
/* Search in current tree or within subtrees depending on the checkbox from filter section */
if($gufilter['SubSearchGroup']){
/* Search in current tree or within subtrees depending on the checkbox from filter section */
if($gufilter['SubSearchGroup']){
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), _("Removing group failed"));
/* Delete references to object groups */
$ldap->cd ($this->config->current['BASE']);
/* Delete references to object groups */
$ldap->cd ($this->config->current['BASE']);
$ldap->$mode($this->attrs);
$ret= 0;
$ldap->$mode($this->attrs);
$ret= 0;
- if (show_ldap_error($ldap->get_error())){
+ if (show_ldap_error($ldap->get_error(), _("Saving group failed"))){
$ret= 1;
}
$ret= 1;
}
}
/* Find out next free id near to UID_BASE */
}
/* 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);
}
}
if (!in_array($id, $ids)){
return ($id);
}
}
- /* Should not happen */
- if ($id == 65000){
- print_red(_("Too many users, can't allocate a free ID!"));
+ /* check if id reached maximum of 32 bit*/
+ if ($id >= pow(2,32)){
+ echo _("Too many users, can't allocate a free ID!");
exit;
}
}
exit;
}
}