fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15419] Limit users


From: sigurdne
Subject: [Fmsystem-commits] [15419] Limit users
Date: Thu, 4 Aug 2016 08:56:01 +0000 (UTC)

Revision: 15419
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15419
Author:   sigurdne
Date:     2016-08-04 08:56:01 +0000 (Thu, 04 Aug 2016)
Log Message:
-----------
Limit users

Modified Paths:
--------------
    trunk/helpdesk/inc/class.uitts.inc.php
    trunk/helpdesk/inc/hook_config.inc.php
    trunk/helpdesk/templates/base/config.tpl
    trunk/phpgwapi/inc/class.acl.inc.php

Modified: trunk/helpdesk/inc/class.uitts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uitts.inc.php      2016-08-04 08:36:19 UTC (rev 
15418)
+++ trunk/helpdesk/inc/class.uitts.inc.php      2016-08-04 08:56:01 UTC (rev 
15419)
@@ -1891,11 +1891,22 @@
 
                private function _get_user_list($selected)
                {
+                       if 
(isset($this->bo->config->config_data['fmtts_assign_group_candidates']) && 
is_array($this->bo->config->config_data['fmtts_assign_group_candidates']))
+                       {
+                               foreach 
($this->bo->config->config_data['fmtts_assign_group_candidates'] as 
$group_candidate)
+                               {
+                                       if ($group_candidate)
+                                       {
+                                               $_candidates[] = 
$group_candidate;
+                                       }
+                               }
+                       }
+
                        $xsl_rootdir = PHPGW_SERVER_ROOT . 
"/property/templates/{$GLOBALS['phpgw_info']['server']['template_set']}";
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select'), $xsl_rootdir);
 
-                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, 
$this->acl_location, 'helpdesk');
+                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, 
$this->acl_location, 'helpdesk', $_candidates);
                        $user_list = array();
                        $selected_found = false;
                        foreach ($users as $user)

Modified: trunk/helpdesk/inc/hook_config.inc.php
===================================================================
--- trunk/helpdesk/inc/hook_config.inc.php      2016-08-04 08:36:19 UTC (rev 
15418)
+++ trunk/helpdesk/inc/hook_config.inc.php      2016-08-04 08:56:01 UTC (rev 
15419)
@@ -28,6 +28,32 @@
 
 
        /**
+        * Get HTML checkbox with groups that are candidates for simplified tts 
interface
+        *
+        * @param $config
+        * @return string HTML checkboxes to be placed in a table
+        */
+       function fmtts_assign_group_candidates( $config )
+       {
+               $groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+               $groups_assigned = 
isset($config['fmtts_assign_group_candidates']) ? 
$config['fmtts_assign_group_candidates'] : array();
+               $out = '';
+               foreach ($groups as $group => $label)
+               {
+                       $checked = '';
+                       if (in_array($group, $groups_assigned))
+                       {
+                               $checked = ' checked';
+                       }
+
+                       $out .= <<<HTML
+                       <tr><td><input type="checkbox" 
name="newsettings[fmtts_assign_group_candidates][]" value="{$group}" 
{$checked}><label>{$label}</label></td></tr>
+HTML;
+               }
+               return $out;
+       }
+
+       /**
        * Get HTML checkbox with groups that are candidates for simplified tts 
interface
        *
        * @param $config

Modified: trunk/helpdesk/templates/base/config.tpl
===================================================================
--- trunk/helpdesk/templates/base/config.tpl    2016-08-04 08:36:19 UTC (rev 
15418)
+++ trunk/helpdesk/templates/base/config.tpl    2016-08-04 08:56:01 UTC (rev 
15419)
@@ -57,7 +57,6 @@
                        </td>
                </tr>
 
-
                <tr class="row_on">
                        <td valign = 'top'>{lang_TTS_simplified_group}:</td>
                        <td>
@@ -68,6 +67,16 @@
                                </table>
                        </td>
                </tr>
+               <tr>
+                       <td valign = 
'top'>{lang_TTS_assign_group_candidates}:</td>
+                       <td>
+                               <!--to be able to blank the setting - need an 
empty value-->
+                               <input type = 'hidden' 
name="newsettings[fmtts_assign_group_candidates][]" value="">
+                               <table>
+                                       {hook_fmtts_assign_group_candidates}
+                               </table>
+                       </td>
+               </tr>
                <tr class="row_on">
                        <td>{lang_Mail_Notification}:</td>
                        <td>

Modified: trunk/phpgwapi/inc/class.acl.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.acl.inc.php        2016-08-04 08:36:19 UTC (rev 
15418)
+++ trunk/phpgwapi/inc/class.acl.inc.php        2016-08-04 08:56:01 UTC (rev 
15419)
@@ -1975,7 +1975,7 @@
                *
                * @return array Array with accounts
                */
-               public function get_user_list_right($required, $location, 
$appname = '')
+               public function get_user_list_right($required, $location, 
$appname = '' , $group_candidates = array())
                {
                        $myaccounts                     = & 
$GLOBALS['phpgw']->accounts;
                        $active_accounts        = array();
@@ -2033,6 +2033,11 @@
                                {
                                        if($entry['account_type']=='g')
                                        {
+                                               if($group_candidates && 
!in_array($entry['account_id'], $group_candidates))
+                                               {
+                                                       continue;
+                                               }
+
                                                $members = 
$myaccounts->member($entry['account_id'], true);
 
                                                if (isset($members) AND 
is_array($members))




reply via email to

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