Code

Updated copy & paste for groups.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 7 Jun 2010 12:30:29 +0000 (12:30 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 7 Jun 2010 12:30:29 +0000 (12:30 +0000)
-Samba SID wasn't set correctly

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18854 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/groups/class_group.inc

index c5daaf909d7c1ea54f9c437a7ddf845f36c6adbd..9dbc14f09303bc9c55c0c7b59437a2adb40977e3 100644 (file)
@@ -1189,6 +1189,46 @@ class group extends plugin
 
       $this->trustModeDialog->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("core","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("core","sambaRidBase") != ""){
+                  $this->sambaDomainName= "DEFAULT";
+                  $this->ridBase= $this->config->get_cfg_value("core","sambaRidBase");
+                  $this->SID= $this->config->get_cfg_value("core","sambaSID");
+              } 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('sambaGroupMapping', $source['objectClass']);
       if ($this->smbgroup) {