phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] admin templates/base/users.xsl inc/class.boacco...


From: Dave Hall
Subject: [Phpgroupware-cvs] admin templates/base/users.xsl inc/class.boacco...
Date: Sat, 08 Jul 2006 06:51:16 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    admin
Changes by:     Dave Hall <skwashd>     06/07/08 06:51:16

Modified files:
        templates/base : users.xsl 
        inc            : class.boaccounts.inc.php 
                         class.uiaccounts.inc.php 

Log message:
        fix account ACLs being lost

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/admin/templates/base/users.xsl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.boaccounts.inc.php?cvsroot=phpgroupware&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.uiaccounts.inc.php?cvsroot=phpgroupware&r1=1.60&r2=1.61

Patches:
Index: templates/base/users.xsl
===================================================================
RCS file: /cvsroot/phpgroupware/admin/templates/base/users.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/users.xsl    14 Feb 2006 09:47:27 -0000      1.1
+++ templates/base/users.xsl    8 Jul 2006 06:51:16 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: users.xsl,v 1.1 2006/02/14 09:47:27 skwashd Exp $ -->
+<!-- $Id: users.xsl,v 1.2 2006/07/08 06:51:16 skwashd Exp $ -->
 
        <xsl:template name="users">
                <xsl:choose>
@@ -272,15 +272,44 @@
 <!-- END form_passwordinfo -->
 
                                                <tr class="row_off">
+                                                       <td><xsl:value-of 
select="lang_contact"/></td>
+                                                       <td>
+                                                               <a 
href="{url_contacts}"><xsl:value-of select="url_contacts_text"/></a>
+                                                       </td>
+                                                       <td><xsl:value-of 
select="lang_changepassword"/></td>
+                                                       <td>
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="changepassword = 1">
+                                                                               
<input type="checkbox" name="values[changepassword]" value="1" 
checked="checked"/>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<input type="checkbox" name="values[changepassword]" value="1"/>
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </td>
+                                               </tr>
+
+                                               <tr class="row_on">
                                                        <td><xsl:value-of 
select="lang_groups"/></td>
-                                                       <td colspan="3">
+                                                       <td>
                                                                <select 
name="account_groups[]" multiple="multiple">
                                                                        
<xsl:apply-templates select="group_list"/>
                                                                </select>
                                                        </td>
+                                                       <td><xsl:value-of 
select="lang_anonymous"/></td>
+                                                       <td>
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="changepassword = 0">
+                                                                               
<input type="checkbox" name="values[anonymous]" value="1" checked="checked"/>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<input type="checkbox" name="values[anonymous]" value="1"/>
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </td>
                                                </tr>
 
-                                               <tr class="row_on">
+                                               <tr class="row_off">
                                                        <td><xsl:value-of 
select="lang_expires"/></td>
                                                        <td><xsl:value-of 
disable-output-escaping="yes" select="select_expires"/></td>
                                                        <td><xsl:value-of 
select="lang_never"/></td>
@@ -361,11 +390,11 @@
                        <td width="40%"><xsl:value-of select="app_title"/></td>
                        <td width="5%" align="center">
                                <xsl:choose>
-                                       <xsl:when test="checked != ''">
-                                               <input type="checkbox" 
name="{$checkbox_name}" value="True" checked="checked"/>
+                                       <xsl:when test="checked = '1'">
+                                               <input type="checkbox" 
name="{$checkbox_name}" value="1" checked="checked" />
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               <input type="checkbox" 
name="{$checkbox_name}" value="True"/>
+                                               <input type="checkbox" 
name="{$checkbox_name}" value="1" />
                                        </xsl:otherwise>
                                </xsl:choose>
                        </td>

Index: inc/class.boaccounts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.boaccounts.inc.php,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- inc/class.boaccounts.inc.php        12 Jun 2006 09:13:17 -0000      1.47
+++ inc/class.boaccounts.inc.php        8 Jul 2006 06:51:16 -0000       1.48
@@ -9,7 +9,7 @@
        *  Free Software Foundation; either version 2 of the License, or (at 
your  *
        *  option) any later version.                                           
   *
        
\**************************************************************************/
-       /* $Id: class.boaccounts.inc.php,v 1.47 2006/06/12 09:13:17 sigurdne 
Exp $ */
+       /* $Id: class.boaccounts.inc.php,v 1.48 2006/07/08 06:51:16 skwashd Exp 
$ */
 
        //FIXME define constants for rights so we can fuck all these magic 
numbers
        
@@ -556,6 +556,40 @@
                        return $account_user;
                }
 
+               /**
+                * Get the user ID of the managers of the addressbook
+                * 
+                * @return array addressmaster ids
+                */
+               function get_addressmaster_ids()
+               {
+                       return 
$GLOBALS['phpgw']->acl->get_ids_for_location('addressmaster',7,'addressbook');
+               }
+               
+
+               function load_group_apps($account_id)
+               {
+                       $account_id = (int) $account_id;
+                       $account_apps = array();
+                       if($account_id)
+                       {
+                               $apps =& CreateObject('phpgwapi.applications', 
$account_id);
+                               $group_apps = $apps->read_account_specific();
+
+                               foreach ( $group_apps as $app )
+                               {
+                                       $account_apps[$app['name']] = True;
+                               }
+                       }
+                       return $account_apps;
+               }
+
+               /**
+                * Get the group manager/s for a group
+                * 
+                * @param int $account_id the group for which managers are 
sought
+                * @return array the manager/s
+                */
                function load_group_managers($account_id)
                {
                        $temp_user = 
$GLOBALS['phpgw']->acl->get_ids_for_location($account_id,PHPGW_ACL_GROUP_MANAGERS,'phpgw_group');
@@ -576,22 +610,6 @@
                        return $account_user;
                }
 
-               function load_group_apps($account_id)
-               {
-                       $account_apps = array();
-                       if($account_id)
-                       {
-                               $apps =& CreateObject('phpgwapi.applications', 
(int) $account_id);
-                               $group_apps = $apps->read_account_specific();
-
-                               foreach ( $group_apps as $app )
-                               {
-                                       $account_apps[$app['name']] = True;
-                               }
-                       }
-                       return $account_apps;
-               }
-
                function rpc_add_user($data)
                {
                        exit;
@@ -609,14 +627,16 @@
                
                function set_module_permissions($id, $modules)
                {
-                       if($id)
+                       $id = (int) $id;
+
+                       if($id && is_array($modules) )
                        {
-                               $apps =& CreateObject('phpgwapi.applications', 
intval($id));
-                               while($app = each($modules)) 
+                               $apps =& CreateObject('phpgwapi.applications', 
$id);
+                               foreach ( $modules as $app_name => $app_status 
) 
                                {
-                                       if($app[1])
+                                       if ( $app_status )
                                        {
-                                               $apps->add($app[0]);
+                                               $apps->add($app_name);
                                        }
                                }
                                $apps->save_repository();

Index: inc/class.uiaccounts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uiaccounts.inc.php,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- inc/class.uiaccounts.inc.php        26 Mar 2006 05:34:14 -0000      1.60
+++ inc/class.uiaccounts.inc.php        8 Jul 2006 06:51:16 -0000       1.61
@@ -9,7 +9,7 @@
        *  Free Software Foundation; either version 2 of the License, or (at 
your  *
        *  option) any later version.                                           
   *
        
\**************************************************************************/
-       /* $Id: class.uiaccounts.inc.php,v 1.60 2006/03/26 05:34:14 skwashd Exp 
$ */
+       /* $Id: class.uiaccounts.inc.php,v 1.61 2006/07/08 06:51:16 skwashd Exp 
$ */
 
        class uiaccounts
        {
@@ -527,9 +527,10 @@
                        $GLOBALS['phpgw']->xslttpl->add_file('users');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('administration') . ': ' . ($account_id?lang('edit user 
account'):lang('add user account'));
 
+                       $acl =& createObject('phpgwapi.acl', $account_id);
                        if ($account_id)
                        {
-                               $user_info = Array
+                               $user_info = array
                                (
                                        'account_name' => 
$GLOBALS['phpgw']->accounts->id2name($account_id),
                                        'account_user' => 
$this->bo->load_group_users($account_id),
@@ -542,12 +543,17 @@
                                $account =& 
CreateObject('phpgwapi.accounts',intval($account_id),'u');
                                $userData = $account->read_repository();
                                $userGroups = $account->membership($account_id);
+                               $userData['anonymous'] = 
$acl->check('anonymous', 1, 'phpgwapi');
+                               $userData['changepassword'] = 
$acl->check('changepassword', 0xFFFF, 'preferences');
+                               
                        }
                        else
                        {
                                $account =& CreateObject('phpgwapi.accounts');
                                $userData = Array();
                                $userData['status'] = 'A';
+                               $userData['anonymous'] = false;
+                               $userData['changepassword'] = true;
                                $userGroups = Array();
                        }
                        $allGroups = $account->get_list('groups');
@@ -560,8 +566,7 @@
                        }
                        else
                        {
-                               /* Change this to be an admin/setup setting.  
For now, default to expire one week from today. */
-                               $time_var = time() + (60*60*24*7);
+                               $time_var = time() + 
$GLOBALS['phpgw_info']['server']['auto_create_expire']; // we assume this is 
sane
                                $userData['account_expires_month'] = 
date('m',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
                                $userData['account_expires_day']   = 
date('d',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
                                $userData['account_expires_year']  = 
date('Y',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
@@ -579,10 +584,44 @@
                                        . '">';
                        }
 
+                       $add_masters= 
$GLOBALS['phpgw']->acl->get_ids_for_location('addressmaster',7,'addressbook');
+                       $add_users      = 
$GLOBALS['phpgw']->accounts->return_members($add_masters);
+                       $masters        = $add_users['users'];
+
+                       if (is_array($masters) && 
in_array($GLOBALS['phpgw_info']['user']['account_id'],$masters))
+                       {
+                               if($userData['person_id'])
+                               {
+                                       $url_contacts_text = lang('Edit entry');
+                                       $url_contacts =   
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                               'menuaction'    => 
'addressbook.uiaddressbook.edit_person',
+                                               'ab_id'         => 
$userData['person_id'],
+                                               'referer'       => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uiaccounts.edit_user', 'account_id' =>  $_account_id) )  
+                                       ));
+                               }
+                               else
+                               {
+                                       $url_contacts_text = lang('This account 
has no contact entry yet');
+                                       $url_contacts = '#';
+                               }
+                       }
+                       else
+                       {
+                               $url_contacts_text = lang('You do not have edit 
access to addressmaster contacts');
+                               $url_contacts =   
$GLOBALS['phpgw']->link('/index.php', array
+                               (
+                                       'menuaction'    => 
'admin.uiaclmanager.edit_addressmasters',
+                                       'account_id'    => 
$GLOBALS['phpgw_info']['user']['account_id'],
+                                       'referer'       => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uiaccounts.edit_user', 'account_id' =>  $_account_id) )
+                               ));
+                       }
+                       
                        $_y = 
$sbox->getyears('account_expires_year',$userData['account_expires_year'],date('Y'),date('Y')+10);
                        $_m = 
$sbox->getmonthtext('account_expires_month',$userData['account_expires_month']);
                        $_d = 
$sbox->getdays('account_expires_day',$userData['account_expires_day']);
 
+
                /*      $account_file_space = '';
                        if (!$userData['file_space'])
                        {
@@ -597,6 +636,7 @@
                        $account_file_space_select ='<select 
name="account_file_space_type">';
                        $account_file_space_types = array ('gb', 'mb', 'kb', 
'b');
                        while (list ($num, $type) = each 
($account_file_space_types))
+                       
                        {
                                $account_file_space_select .= '<option 
value="'.$type.'"' . $account_file_space_type_selected[$type] . '>' . 
strtoupper ($type) . '</option>';
                        }
@@ -636,7 +676,6 @@
                        $apps =& 
CreateObject('phpgwapi.applications',$account_id);
                        $db_perms = $apps->read_account_specific();
 
-                       @reset($GLOBALS['phpgw_info']['apps']);
                        $available_apps = $GLOBALS['phpgw_info']['apps'];
                        @asort($available_apps);
                        foreach ( $available_apps as $key => $application ) 
@@ -658,7 +697,7 @@
                                (
                                        'app_title'             => 
$perm_display[$i]['translatedName'],
                                        'checkbox_name' => 
'account_permissions[' . $perm_display[$i]['appName'] . ']',
-                                       'checked'               => 
($userData['account_permissions'][$perm_display[$i]['appName']] || 
$db_perms[$perm_display[$i]['appName']]?'yes':'')
+                                       'checked'               => 
($userData['account_permissions'][$perm_display[$i]['appName']] || 
$db_perms[$perm_display[$i]['appName']]? '1' : '0')
                                );
                        }
 
@@ -675,6 +714,9 @@
                                'edit_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$page_params),
                                'lang_lid'                              => 
lang('loginid'),
                                'lang_account_active'   => lang('account 
active'),
+                               'lang_anonymous'                => 
lang('Anonymous User (not shown in list sessions)'),
+                               'lang_changepassword'   => lang('Can change 
password'),
+                               'lang_contact'                  => 
lang('contact'),
                                'lang_password'                 => 
lang('password'),
                                'lang_reenter_password' => lang('Re-Enter 
Password'),
                                'lang_lastname'                 => 
lang('lastname'),
@@ -696,9 +738,13 @@
                                'account_lastname'              => 
$userData['account_lastname'],
                                'account_passwd'                => 
$account_passwd,
                                'account_passwd_2'              => 
$account_passwd_2,
+                               'anonymous'                             => 
(int) $userData['anonymous'],
+                               'changepassword'                => (int) 
$userData['changepassword'],
                                'expires_never'                 => 
(($userData['expires'] == -1)?'yes':''),
                                'group_list'                    => $group_list,
-                               'app_list'                              => 
$app_list
+                               'app_list'                              => 
$app_list,
+                               'url_contacts'                  => 
$url_contacts,
+                               'url_contacts_text'             => 
$url_contacts_text
                        );
 
                        /* create the menu on the left, if needed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]