diff --git a/gosa-core/plugins/admin/groups/class_group.inc b/gosa-core/plugins/admin/groups/class_group.inc
index a2519c1c3052eac498501657497decf8ad79955b..45658dd418130d36035769c57f35190bac97eceb 100644 (file)
}
/* Set mail flag */
- if (isset($this->attrs['objectClass']) && in_array('gosaMailAccount', $this->attrs['objectClass'])){
+ if (isset($this->attrs['objectClass']) && in_array_strict('gosaMailAccount', $this->attrs['objectClass'])){
$this->has_mailAccount= TRUE;
}
$this->dialog= FALSE;
}
- /* Base select dialog */
- $once = true;
- foreach($_POST as $name => $value){
- if((preg_match("/^chooseBase/",$name) && $once) && $this->acl_is_writeable("base")){
-
- $once = false;
- $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
- $this->dialog->setCurrentBase($this->base);
- }
- }
-
/* Dialog handling */
if(is_object($this->dialog)){
/* Must be called before save_object */
$smarty->assign("memberUid_Some",$this->memberUid_used_by_some);
foreach($this->attributes as $val){
- if(in_array($val,$this->multi_boxes)){
+ if(in_array_strict($val,$this->multi_boxes)){
$smarty->assign("use_".$val,TRUE);
}else{
$smarty->assign("use_".$val,FALSE);
}
}
foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group","trustmode") as $val){
- if(in_array($val,$this->multi_boxes)){
+ if(in_array_strict($val,$this->multi_boxes)){
$smarty->assign("use_".$val,TRUE);
}else{
$smarty->assign("use_".$val,FALSE);
/* Fetch all users and skip already used users */
foreach($res as $attrs){
- if(in_array($attrs['uid'][0], $this->memberUid)) {
+ if(in_array_strict($attrs['uid'][0], $this->memberUid)) {
continue;
}
$i ++;
/* Save data to object */
function save_object()
{
- /* Refresh base */
- if ($this->acl_is_moveable($this->base)){
- if (!$this->baseSelector->update()) {
- msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
- }
- if ($this->base != $this->baseSelector->getBase()) {
- $this->base= $this->baseSelector->getBase();
- $this->is_modified= TRUE;
- }
- }
-
/* Save additional values for possible next step */
if (isset($_POST['groupedit'])){
plugin::save_object();
$this->base = $base_tmp;
+ /* Refresh base */
+ if ($this->acl_is_moveable($this->base)){
+ if (!$this->baseSelector->update()) {
+ msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+ }
+ if ($this->base != $this->baseSelector->getBase()) {
+ $this->base= $this->baseSelector->getBase();
+ $this->is_modified= TRUE;
+ }
+ }
+
$this->force_gid= 0;
/* Only reset sambagroup flag if we are able to write this flag */
if ($this->groupType == 0){
if ($this->sambaSID == "" || $this->oldgroupType != $this->groupType){
- $gidNumber= $this->gidNumber;
- while(TRUE){
- $sid= $this->SID."-".($gidNumber*2 + $this->ridBase+1);
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(sambaSID=$sid)",array("sambaSID"));
- if ($ldap->count() == 0){
- break;
- }
- $gidNumber++;
- }
+ $sid = $this->getSambaSID();
$this->attrs['sambaSID']= $sid;
$this->sambaSID= $sid;
}
$message[]= msgPool::required(_("Name"));
}
+ // Check if a wrong base was supplied
+ if(!$this->baseSelector->checkLastBaseUpdate()){
+ $message[]= msgPool::check_base();;
+ }
+
/* Check for valid input */
if (!tests::is_uid($this->cn)){
if (strict_uid_mode()){
}
}
+ // Check if a wrong base was supplied
+ if(!$this->baseSelector->checkLastBaseUpdate()){
+ $message[]= msgPool::check_base();;
+ }
+
if($this->allowGroupsWithSameNameInOtherSubtrees == true){
/* Check for used 'cn' */
$ret = plugin::get_multi_edit_values();
foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group","nagios_group") as $attr){
- if(in_array($attr,$this->multi_boxes)){
+ if(in_array_strict($attr,$this->multi_boxes)){
$ret[$attr] = $this->$attr;
}
}
- if(in_array("trustmode",$this->multi_boxes)){
+ if(in_array_strict("trustmode",$this->multi_boxes)){
$ret['trustModel'] = $this->trustModel;
$ret['accessTo'] = $this->accessTo;
}
if (isset($all['memberUid'])){
for ($i= 0; $i<$all['memberUid']['count']; $i++){
- if(!in_array($all['memberUid'][$i],$this->memberUid)){
+ if(!in_array_strict($all['memberUid'][$i],$this->memberUid)){
$this->memberUid_used_by_some[$all['memberUid'][$i]]= $all['memberUid'][$i];
}
}
{
plugin::PrepareForCopyPaste($source);
+ /* Get samba Domain in case of samba 3 */
+ if ($this->sambaSID != ""){
+ $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase"));
+ if ($ldap->count() != 0){
+ $attrs= $ldap->fetch();
+ if(isset($attrs['sambaAlgorithmicRidBase'])){
+ $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
+ } else {
+ $this->ridBase= $this->config->get_cfg_value("sambaRidBase");
+ }
+
+ /* Get domain name for SID */
+ $this->sambaDomainName= "DEFAULT";
+ foreach ($this->config->data['SERVERS']['SAMBA'] as $key => $val){
+ if ($val['SID'] == $this->SID){
+ $this->sambaDomainName= $key;
+ break;
+ }
+ }
+ } else {
+ if ($this->config->get_cfg_value("sambaRidBase") != ""){
+ $this->sambaDomainName= "DEFAULT";
+ $this->ridBase= $this->config->get_cfg_value("sambaRidBase");
+ $this->SID= $this->config->get_cfg_value("sid");
+ } else {
+ msg_dialog::display(_("Configuration error"), _("Cannot find group SID in your configuration!"), ERROR_DIALOG);
+ }
+ }
+
+ /* Get group type */
+ $this->groupType= (int)substr(strrchr($this->sambaSID, "-"), 1);
+ if ($this->groupType < 500 || $this->groupType > 553){
+ $this->groupType= 0;
+ }
+ $this->oldgroupType= $this->groupType;
+ }
+
+
+ // Detect samba groups and adapt its values.
+ $this->smbgroup = in_array_strict('sambaGroupMapping', $source['objectClass']);
+ if ($this->smbgroup) {
+ $this->sambaSID = $this->getSambaSID();
+ }
+
$this->memberUid = array();
if(isset($source['memberUid'])){
for($i = 0 ; $i < $source['memberUid']['count']; $i ++){
/* Update groupMembership, keep optinal group */
foreach($attrs['memberUid_used_by_some'] as $uid){
- if(in_array($uid,$this->memberUid)){
+ if(in_array_strict($uid,$this->memberUid)){
$users[$uid] = $uid;
}
}
plugin::set_multi_edit_values($attrs);
$this->memberUid = $users;
}
+
+
+ /*! \brief Get a new SambaSID for a group */
+ function getSambaSID()
+ {
+ $ldap = $this->config->get_ldap_link();
+ $gidNumber= $this->gidNumber;
+ while(TRUE){
+ $sid= $this->SID."-".($gidNumber*2 + $this->ridBase+1);
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(sambaSID=$sid)",array("sambaSID"));
+ if ($ldap->count() == 0){
+ break;
+ }
+ $gidNumber++;
+ }
+
+ return $sid;
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>