[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/admin/inc/ -> class.soaccounts.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - account administration                                      *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      \**************************************************************************/
  11  
  12      /* $Id: class.soaccounts.inc.php 21491 2006-04-30 12:26:59Z ralfbecker $ */
  13  
  14      class soaccounts
  15      {
  16  		function soaccounts()
  17          {
  18          }
  19  
  20  		function add_user($userData)
  21          {
  22              $userData['account_expires']    = $userData['expires'];
  23              //$userData['account_email']     = $userData['email'];
  24              
  25              if($userData['email'] != "")
  26              {
  27                  $userData['account_email'] = $userData['email'];
  28              }
  29              
  30              if (!($userData['account_id'] = $GLOBALS['egw']->accounts->create($userData)))
  31              {
  32                  return false;
  33              }
  34              $apps =& CreateObject('phpgwapi.applications',$userData['account_id']);
  35              $apps->read_installed_apps();
  36              // Read Group Apps
  37              if ($userData['account_groups'])
  38              {
  39                  $apps->account_type = 'g';
  40                  reset($userData['account_groups']);
  41                  while($groups = each($userData['account_groups']))
  42                  {
  43                      $apps->account_id = $groups[0];
  44                      $old_app_groups = $apps->read_account_specific();
  45                      @reset($old_app_groups);
  46                      while($old_group_app = each($old_app_groups))
  47                      {
  48                          if (!$apps_after[$old_group_app[0]])
  49                          {
  50                              $apps_after[$old_group_app[0]] = $old_app_groups[$old_group_app[0]];
  51                          }
  52                      }
  53                  }
  54              }
  55  
  56              $apps->account_type = 'u';
  57              $apps->account_id = $userData['account_id'];
  58              $apps->data = Array(Array());
  59  
  60              if ($userData['account_permissions'])
  61              {
  62                  @reset($userData['account_permissions']);
  63                  while (list($app,$turned_on) = each($userData['account_permissions']))
  64                  {
  65                      if ($turned_on)
  66                      {
  67                          $apps->add($app);
  68                          if (!$apps_after[$app])
  69                          {
  70                              $apps_after[] = $app;
  71                          }
  72                      }
  73                  }
  74              }
  75              $apps->save_repository();
  76  
  77              if ($userData['changepassword'])
  78              {
  79                  $GLOBALS['egw']->acl->add_repository('preferences','changepassword',$userData['account_id'],1);
  80              }
  81              // Assign user to groups
  82              if ($userData['account_groups'])
  83              {
  84                  $c_acct_groups = count($userData['account_groups']);
  85                  for ($i=0;$i<$c_acct_groups;$i++)
  86                  {
  87                      $GLOBALS['egw']->acl->add_repository('phpgw_group',$userData['account_groups'][$i],$userData['account_id'],1);
  88                  }
  89              }
  90  
  91              $apps->account_apps = array(array());
  92              $apps_after = array(array());
  93  
  94              return $userData['account_id'];
  95          }
  96      }
  97  ?>


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