[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/sambaadmin/inc/ -> class.bosambaadmin.inc.php (source)

   1  <?php
   2      /***************************************************************************\
   3      * eGroupWare - SambaAdmin                                                   *
   4      * http://www.egroupware.org                                                 *
   5      * http://www.linux-at-work.de                                               *
   6      * Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
   7      * -------------------------------------------------                         *
   8      * This program is free software; you can redistribute it and/or modify it   *
   9      * under the terms of the GNU General Public License as published by the     *
  10      * Free Software Foundation; either version 2 of the License, or (at your    *
  11      * option) any later version.                                                *
  12      \***************************************************************************/
  13      /* $Id: class.bosambaadmin.inc.php 19994 2005-11-25 12:36:45Z lkneschke $ */
  14  
  15      class bosambaadmin
  16      {
  17          var $sessionData;
  18          var $LDAPData;
  19  
  20  		function bosambaadmin()
  21          {
  22              #
  23  
  24              $this->sosambaadmin =& CreateObject('sambaadmin.sosambaadmin');
  25              
  26              $this->restoreSessionData();
  27  
  28          }
  29  
  30  		function checkLDAPSetup()
  31          {
  32              return $this->sosambaadmin->checkLDAPSetup();
  33          }
  34          
  35  		function changePassword($_accountID, $_newPassword)
  36          {
  37              if (!$GLOBALS['egw_info']['server']['ldap_host']) return false;
  38  
  39              return $this->sosambaadmin->changePassword($_accountID, $_newPassword);
  40          }
  41          
  42  		function deleteWorkstation($_workstations)
  43          {
  44              return $this->sosambaadmin->deleteWorkstation($_workstations);
  45          }
  46          
  47  		function expirePassword($_accountID)
  48          {
  49              return $this->sosambaadmin->expirePassword($_accountID);
  50          }
  51          
  52  		function getUserData($_accountID, $_usecache)
  53          {
  54              if ($_usecache)
  55              {
  56                  $userData = $this->userSessionData[$_accountID];
  57              }
  58              else
  59              {
  60                  $userData = $this->sosambaadmin->getUserData($_accountID);
  61                  $this->userSessionData[$_accountID] = $userData;
  62                  $this->saveSessionData();
  63              }
  64              return $userData;
  65          }
  66  
  67  		function getWorkstationData($_uidnumber)
  68          {
  69              return $this->sosambaadmin->getWorkstationData($_uidnumber);
  70          }
  71          
  72  		function getWorkstationList($_start, $_sort, $_order, $_searchString)
  73          {
  74              return $this->sosambaadmin->getWorkstationList($_start, $_sort, $_order, $_searchString);
  75          }
  76  
  77  		function restoreSessionData()
  78          {
  79              $this->sessionData = $GLOBALS['egw']->session->appsession('session_data');
  80              $this->userSessionData = $GLOBALS['egw']->session->appsession('user_session_data');
  81          }
  82          
  83  		function saveSessionData()
  84          {
  85              $GLOBALS['egw']->session->appsession('session_data','',$this->sessionData);
  86              $GLOBALS['egw']->session->appsession('user_session_data','',$this->userSessionData);
  87          }
  88          
  89  		function saveUserData($_accountID, $_formData)
  90          {
  91              return $this->sosambaadmin->saveUserData($_accountID, $_formData);
  92          }
  93  
  94  		function updateAccount()
  95          {
  96              if (!$GLOBALS['egw_info']['server']['ldap_host']) return false;
  97  
  98              if($accountID = (int)$GLOBALS['hook_values']['account_id'])
  99              {
 100                  $config =& CreateObject('phpgwapi.config','sambaadmin');
 101                  $config->read_repository();
 102                  $config = $config->config_data;
 103  
 104                  $oldAccountData = $this->getUserData($accountID,false);
 105  
 106                  // account_status
 107                  $accountData = array();
 108                  if($GLOBALS['hook_values']['new_passwd'])
 109                  {
 110                      $accountData['password']    = $GLOBALS['hook_values']['new_passwd'];
 111                  }
 112                  if(!$oldAccountData['sambahomedrive'] && $config['samba_homedrive'])
 113                      $accountData['sambahomedrive']        = $config['samba_homedrive'];
 114                  if(!$oldAccountData['sambahomepath'] && $config['samba_homepath'])
 115                      $accountData['sambahomepath']        = $config['samba_homepath'].$GLOBALS['hook_values']['account_lid'];
 116                  if(!$oldAccountData['sambalogonscript'] && $config['samba_logonscript'])
 117                      $accountData['sambalogonscript']    = $config['samba_logonscript'];
 118                  if(!$oldAccountData['sambaprofilepath'] && $config['samba_profilepath'])
 119                      $accountData['sambaprofilepath']    = $config['samba_profilepath'].$GLOBALS['hook_values']['account_lid'];
 120                  $accountData['status']                = ($GLOBALS['hook_values']['account_status'] == 'A' ? 'activated' : 'deactivated');
 121  
 122                  return $this->sosambaadmin->saveUserData($accountID, $accountData);
 123              }
 124  
 125              // something went wrong
 126              return false;
 127          }
 128  
 129  		function updateGroup()
 130          {
 131              if (!$GLOBALS['egw_info']['server']['ldap_host']) return false;
 132  
 133              if($accountID = (int)$GLOBALS['hook_values']['account_id'])
 134              {
 135                  return $this->sosambaadmin->updateGroup($accountID);
 136              }
 137              return false;
 138          }
 139                  
 140  		function updateWorkstation($_newData)
 141          {
 142              if(!$this->verifyData($_newData))
 143                  return false;
 144                  
 145              return $this->sosambaadmin->updateWorkstation($_newData);
 146          }
 147          
 148  		function verifyData($_newData)
 149          {
 150              return true;
 151          }
 152      }
 153  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7