当前位置: 首页>>代码示例>>PHP>>正文


PHP SecurityGroup::getGroupUsersWhere方法代码示例

本文整理汇总了PHP中SecurityGroup::getGroupUsersWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP SecurityGroup::getGroupUsersWhere方法的具体用法?PHP SecurityGroup::getGroupUsersWhere怎么用?PHP SecurityGroup::getGroupUsersWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SecurityGroup的用法示例。


在下文中一共展示了SecurityGroup::getGroupUsersWhere方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_new_list_query

 /**
  * Return the list query used by the list views and export button. Next generation of create_new_list_query function.
  *
  * Override this function to return a custom query.
  *
  * @param string $order_by custom order by clause
  * @param string $where custom where clause
  * @param array $filter Optioanal
  * @param array $params Optional     *
  * @param int $show_deleted Optional, default 0, show deleted records is set to 1.
  * @param string $join_type
  * @param boolean $return_array Optional, default false, response as array
  * @param object $parentbean creating a subquery for this bean.
  * @param boolean $singleSelect Optional, default false.
  * @return String select query string, optionally an array value will be returned if $return_array= true.
  */
 function create_new_list_query($order_by, $where, $filter = array(), $params = array(), $show_deleted = 0, $join_type = '', $return_array = false, $parentbean = null, $singleSelect = false, $ifListForExport = false)
 {
     global $beanFiles, $beanList;
     $selectedFields = array();
     $secondarySelectedFields = array();
     $ret_array = array();
     $distinct = '';
     if ($this->bean_implements('ACL') && ACLController::requireOwner($this->module_dir, 'list')) {
         global $current_user;
         $owner_where = $this->getOwnerWhere($current_user->id);
         if (empty($where)) {
             $where = $owner_where;
         } else {
             $where .= ' AND ' . $owner_where;
         }
     }
     /* BEGIN - SECURITY GROUPS */
     global $current_user, $sugar_config;
     if ($this->module_dir == 'Users' && !is_admin($current_user) && isset($sugar_config['securitysuite_filter_user_list']) && $sugar_config['securitysuite_filter_user_list'] == true) {
         require_once 'modules/SecurityGroups/SecurityGroup.php';
         global $current_user;
         $group_where = SecurityGroup::getGroupUsersWhere($current_user->id);
         //$group_where = "user_name = 'admin'";
         if (empty($where)) {
             $where = " (" . $group_where . ") ";
         } else {
             $where .= " AND (" . $group_where . ") ";
         }
     } else {
         if ($this->bean_implements('ACL') && ACLController::requireSecurityGroup($this->module_dir, 'list')) {
             require_once 'modules/SecurityGroups/SecurityGroup.php';
             global $current_user;
             $owner_where = $this->getOwnerWhere($current_user->id);
             $group_where = SecurityGroup::getGroupWhere($this->table_name, $this->module_dir, $current_user->id);
             if (!empty($owner_where)) {
                 if (empty($where)) {
                     $where = " (" . $owner_where . " or " . $group_where . ") ";
                 } else {
                     $where .= " AND (" . $owner_where . " or " . $group_where . ") ";
                 }
             } else {
                 $where .= ' AND ' . $group_where;
             }
         }
     }
     /* END - SECURITY GROUPS */
     if (!empty($params['distinct'])) {
         $distinct = ' DISTINCT ';
     }
     if (empty($filter)) {
         $ret_array['select'] = " SELECT {$distinct} {$this->table_name}.* ";
     } else {
         $ret_array['select'] = " SELECT {$distinct} {$this->table_name}.id ";
     }
     $ret_array['from'] = " FROM {$this->table_name} ";
     $ret_array['from_min'] = $ret_array['from'];
     $ret_array['secondary_from'] = $ret_array['from'];
     $ret_array['where'] = '';
     $ret_array['order_by'] = '';
     //secondary selects are selects that need to be run after the primary query to retrieve additional info on main
     if ($singleSelect) {
         $ret_array['secondary_select'] =& $ret_array['select'];
         $ret_array['secondary_from'] =& $ret_array['from'];
     } else {
         $ret_array['secondary_select'] = '';
     }
     $custom_join = $this->getCustomJoin(empty($filter) ? true : $filter);
     if (!isset($params['include_custom_fields']) || $params['include_custom_fields']) {
         $ret_array['select'] .= $custom_join['select'];
     }
     $ret_array['from'] .= $custom_join['join'];
     // Bug 52490 - Captivea (Sve) - To be able to add custom fields inside where clause in a subpanel
     $ret_array['from_min'] .= $custom_join['join'];
     $jtcount = 0;
     //LOOP AROUND FOR FIXIN VARDEF ISSUES
     require 'include/VarDefHandler/listvardefoverride.php';
     if (file_exists('custom/include/VarDefHandler/listvardefoverride.php')) {
         require 'custom/include/VarDefHandler/listvardefoverride.php';
     }
     $joined_tables = array();
     if (!empty($params['joined_tables'])) {
         foreach ($params['joined_tables'] as $table) {
             $joined_tables[$table] = 1;
         }
//.........这里部分代码省略.........
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:101,代码来源:SugarBean.php

示例2: get_bean_select_array

function get_bean_select_array($add_blank = true, $bean_name, $display_columns, $where = '', $order_by = '', $blank_is_none = false)
{
    global $beanFiles;
    require_once $beanFiles[$bean_name];
    $focus = new $bean_name();
    $user_array = array();
    $key = $bean_name == 'EmailTemplate' ? $bean_name : $bean_name . $display_columns . $where . $order_by;
    $user_array = get_register_value('select_array', $key);
    if (!$user_array) {
        $db = DBManagerFactory::getInstance();
        $temp_result = array();
        $query = "SELECT {$focus->table_name}.id, {$display_columns} as display from {$focus->table_name} ";
        $query .= "where ";
        if ($where != '') {
            $query .= $where . " AND ";
        }
        $query .= " {$focus->table_name}.deleted=0";
        /* BEGIN - SECURITY GROUPS */
        global $current_user, $sugar_config;
        if ($focus->module_dir == 'Users' && !is_admin($current_user) && isset($sugar_config['securitysuite_filter_user_list']) && $sugar_config['securitysuite_filter_user_list'] == true) {
            require_once 'modules/SecurityGroups/SecurityGroup.php';
            $group_where = SecurityGroup::getGroupUsersWhere($current_user->id);
            $query .= " AND (" . $group_where . ") ";
        } else {
            if ($focus->bean_implements('ACL') && ACLController::requireSecurityGroup($focus->module_dir, 'list')) {
                require_once 'modules/SecurityGroups/SecurityGroup.php';
                $owner_where = $focus->getOwnerWhere($current_user->id);
                $group_where = SecurityGroup::getGroupWhere($focus->table_name, $focus->module_dir, $current_user->id);
                if (!empty($owner_where)) {
                    $query .= " AND (" . $owner_where . " or " . $group_where . ") ";
                } else {
                    $query .= ' AND ' . $group_where;
                }
            }
        }
        /* END - SECURITY GROUPS */
        if ($order_by != '') {
            $query .= " order by {$focus->table_name}.{$order_by}";
        }
        $GLOBALS['log']->debug("get_user_array query: {$query}");
        $result = $db->query($query, true, "Error filling in user array: ");
        if ($add_blank == true) {
            // Add in a blank row
            if ($blank_is_none == true) {
                // set 'blank row' to "--None--"
                global $app_strings;
                $temp_result[''] = $app_strings['LBL_NONE'];
            } else {
                $temp_result[''] = '';
            }
        }
        // Get the id and the name.
        while ($row = $db->fetchByAssoc($result)) {
            $temp_result[$row['id']] = $row['display'];
        }
        $user_array = $temp_result;
        set_register_value('select_array', $key, $temp_result);
    }
    return $user_array;
}
开发者ID:pikkoui,项目名称:suitecrm,代码行数:60,代码来源:utils.php

示例3: getUserArrayFromFullName

/**
 * uses a different query to return a list of users than get_user_array()
 * @param args string where clause entry
 * @return array Array of Users' details that match passed criteria
 */
function getUserArrayFromFullName($args, $hide_portal_users = false)
{
    global $locale;
    $db = DBManagerFactory::getInstance();
    $argArray = array();
    if (strpos($args, " ")) {
        $argArray = explode(" ", $args);
    } else {
        $argArray[] = $args;
    }
    $inClause = '';
    foreach ($argArray as $arg) {
        if (!empty($inClause)) {
            $inClause .= ' OR ';
        }
        if (empty($arg)) {
            continue;
        }
        $inClause .= "(first_name LIKE '{$arg}%' OR last_name LIKE '{$arg}%')";
    }
    $query = "SELECT id, first_name, last_name, user_name FROM users WHERE status='Active' AND deleted=0 AND ";
    if ($hide_portal_users) {
        $query .= " portal_only=0 AND ";
    }
    $query .= $inClause;
    /* BEGIN - SECURITY GROUPS */
    global $current_user, $sugar_config;
    if (!is_admin($current_user) && isset($sugar_config['securitysuite_filter_user_list']) && $sugar_config['securitysuite_filter_user_list'] == true) {
        require_once 'modules/SecurityGroups/SecurityGroup.php';
        global $current_user;
        $group_where = SecurityGroup::getGroupUsersWhere($current_user->id);
        $query .= " AND (" . $group_where . ") ";
    }
    /* END - SECURITY GROUPS */
    $query .= " ORDER BY last_name ASC";
    $r = $db->query($query);
    $ret = array();
    while ($a = $db->fetchByAssoc($r)) {
        $ret[$a['id']] = $locale->getLocaleFormattedName($a['first_name'], $a['last_name']);
    }
    return $ret;
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:47,代码来源:utils.php


注:本文中的SecurityGroup::getGroupUsersWhere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。