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


PHP user_get_all_accessible_subprojects函数代码示例

本文整理汇总了PHP中user_get_all_accessible_subprojects函数的典型用法代码示例。如果您正苦于以下问题:PHP user_get_all_accessible_subprojects函数的具体用法?PHP user_get_all_accessible_subprojects怎么用?PHP user_get_all_accessible_subprojects使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: helper_project_specific_where

function helper_project_specific_where($p_project_id, $p_user_id = null)
{
    if (null === $p_user_id) {
        $p_user_id = auth_get_current_user_id();
    }
    if (ALL_PROJECTS == $p_project_id) {
        $t_topprojects = $t_project_ids = user_get_accessible_projects($p_user_id);
        foreach ($t_topprojects as $t_project) {
            $t_project_ids = array_merge($t_project_ids, user_get_all_accessible_subprojects($p_user_id, $t_project));
        }
        $t_project_ids = array_unique($t_project_ids);
    } else {
        access_ensure_project_level(VIEWER, $p_project_id);
        $t_project_ids = user_get_all_accessible_subprojects($p_user_id, $p_project_id);
        array_unshift($t_project_ids, $p_project_id);
    }
    $t_project_ids = array_map('db_prepare_int', $t_project_ids);
    if (0 == count($t_project_ids)) {
        $t_project_filter = ' 1<>1';
    } elseif (1 == count($t_project_ids)) {
        $t_project_filter = ' project_id=' . $t_project_ids[0];
    } else {
        $t_project_filter = ' project_id IN (' . join(',', $t_project_ids) . ')';
    }
    return $t_project_filter;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:26,代码来源:helper_api.php

示例2: filter_get_bug_rows


//.........这里部分代码省略.........
    foreach ($t_project_ids as $t_pid) {
        if ($t_pid == META_FILTER_CURRENT) {
            $t_pid = $t_project_id;
        }
        if ($t_pid == ALL_PROJECTS) {
            $t_all_projects_found = true;
            log_event(LOG_FILTERING, 'all projects selected');
            break;
        }
        # filter out inaccessible projects.
        if (!project_exists($t_pid) || !access_has_project_level(config_get('view_bug_threshold', null, $t_user_id, $t_pid), $t_pid, $t_user_id)) {
            log_event(LOG_FILTERING, 'Invalid or inaccessible project: ' . $t_pid);
            continue;
        }
        $t_new_project_ids[] = $t_pid;
    }
    $t_projects_query_required = true;
    if ($t_all_projects_found) {
        if (user_is_administrator($t_user_id)) {
            log_event(LOG_FILTERING, 'all projects + administrator, hence no project filter.');
            $t_projects_query_required = false;
        } else {
            $t_project_ids = user_get_accessible_projects($t_user_id);
        }
    } else {
        $t_project_ids = $t_new_project_ids;
    }
    if ($t_projects_query_required) {
        # expand project ids to include sub-projects
        if ($t_include_sub_projects) {
            $t_top_project_ids = $t_project_ids;
            foreach ($t_top_project_ids as $t_pid) {
                log_event(LOG_FILTERING, 'Getting sub-projects for project id @P' . $t_pid);
                $t_subproject_ids = user_get_all_accessible_subprojects($t_user_id, $t_pid);
                if (!$t_subproject_ids) {
                    continue;
                }
                $t_project_ids = array_merge($t_project_ids, $t_subproject_ids);
            }
            $t_project_ids = array_unique($t_project_ids);
        }
        # if no projects are accessible, then return an empty array.
        if (count($t_project_ids) == 0) {
            log_event(LOG_FILTERING, 'no accessible projects');
            return array();
        }
        log_event(LOG_FILTERING, 'project_ids after including sub-projects = @P' . implode(', @P', $t_project_ids));
        # this array is to be populated with project ids for which we only want to show public issues.  This is due to the limited
        # access of the current user.
        $t_public_only_project_ids = array();
        # this array is populated with project ids that the current user has full access to.
        $t_private_and_public_project_ids = array();
        $t_limited_projects = array();
        foreach ($t_project_ids as $t_pid) {
            # limit reporters to visible projects
            if (ON === $t_limit_reporters && !access_has_project_level(config_get('report_bug_threshold', null, $t_user_id, $t_pid) + 1, $t_pid, $t_user_id)) {
                array_push($t_limited_projects, '({bug}.project_id=' . $t_pid . ' AND ({bug}.reporter_id=' . $t_user_id . ') )');
            } else {
                $t_access_required_to_view_private_bugs = config_get('private_bug_threshold', null, null, $t_pid);
                if (access_has_project_level($t_access_required_to_view_private_bugs, $t_pid, $t_user_id)) {
                    $t_private_and_public_project_ids[] = $t_pid;
                } else {
                    $t_public_only_project_ids[] = $t_pid;
                }
            }
        }
开发者ID:vipjaven,项目名称:mantisbt,代码行数:67,代码来源:filter_api.php

示例3: current_user_get_all_accessible_subprojects

/**
 * Returns an array of subprojects of the specified project to which the
 * currently logged in user has access, including subprojects of subprojects
 *
 * @param project_id	Parent project id.
 * @return an array of accessible sub-project ids.
 * @access public
 */
function current_user_get_all_accessible_subprojects($p_project_id)
{
    return user_get_all_accessible_subprojects(auth_get_current_user_id(), $p_project_id);
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:12,代码来源:current_user_api.php

示例4: user_get_all_accessible_projects

/**
 * retun an array of sub-project IDs of all project to which the user has access
 * @param integer $p_user_id    A valid user identifier.
 * @param integer $p_project_id A valid project identifier.
 * @return array
 */
function user_get_all_accessible_projects($p_user_id, $p_project_id)
{
    if (ALL_PROJECTS == $p_project_id) {
        $t_topprojects = user_get_accessible_projects($p_user_id);
        # Cover the case for PHP < 5.4 where array_combine() returns
        # false and triggers warning if arrays are empty (see #16187)
        if (empty($t_topprojects)) {
            return array();
        }
        # Create a combined array where key = value
        $t_project_ids = array_combine($t_topprojects, $t_topprojects);
        # Add all subprojects user has access to
        foreach ($t_topprojects as $t_project) {
            $t_subprojects_ids = user_get_all_accessible_subprojects($p_user_id, $t_project);
            foreach ($t_subprojects_ids as $t_id) {
                $t_project_ids[$t_id] = $t_id;
            }
        }
    } else {
        access_ensure_project_level(VIEWER, $p_project_id);
        $t_project_ids = user_get_all_accessible_subprojects($p_user_id, $p_project_id);
        array_unshift($t_project_ids, $p_project_id);
    }
    return $t_project_ids;
}
开发者ID:pkdevboxy,项目名称:mantisbt,代码行数:31,代码来源:user_api.php

示例5: access_ensure_project_level

access_ensure_project_level(config_get('view_summary_threshold'));
$f_project_id = gpc_get_int('project_id', helper_get_current_project());
# Override the current page to make sure we get the appropriate project-specific configuration
$g_project_override = $f_project_id;
$t_user_id = auth_get_current_user_id();
# @@@ giallu: this block of code is duplicated from helper_project_specific_where
# the only diff is the commented line below: can we do better than this ?
if (ALL_PROJECTS == $f_project_id) {
    $t_topprojects = $t_project_ids = user_get_accessible_projects($t_user_id);
    foreach ($t_topprojects as $t_project) {
        $t_project_ids = array_merge($t_project_ids, user_get_all_accessible_subprojects($t_user_id, $t_project));
    }
    $t_project_ids = array_unique($t_project_ids);
} else {
    # access_ensure_project_level( VIEWER, $p_project_id );
    $t_project_ids = user_get_all_accessible_subprojects($t_user_id, $f_project_id);
    array_unshift($t_project_ids, $f_project_id);
}
$t_project_ids = array_map('db_prepare_int', $t_project_ids);
if (0 == count($t_project_ids)) {
    $specific_where = ' 1 <> 1';
} elseif (1 == count($t_project_ids)) {
    $specific_where = ' project_id=' . $t_project_ids[0];
} else {
    $specific_where = ' project_id IN (' . join(',', $t_project_ids) . ')';
}
# end @@@ block
$t_bug_table = config_get('mantis_bug_table');
$t_history_table = config_get('mantis_bug_history_table');
$t_resolved = config_get('bug_resolved_status_threshold');
# the issue may have passed through the status we consider resolved
开发者ID:jin255ff,项目名称:company_website,代码行数:31,代码来源:summary_page.php

示例6: user_get_all_accessible_projects

function user_get_all_accessible_projects($p_user_id, $p_project_id)
{
    if (ALL_PROJECTS == $p_project_id) {
        $t_topprojects = $t_project_ids = user_get_accessible_projects($p_user_id);
        foreach ($t_topprojects as $t_project) {
            $t_project_ids = array_merge($t_project_ids, user_get_all_accessible_subprojects($p_user_id, $t_project));
        }
        $t_project_ids = array_unique($t_project_ids);
    } else {
        access_ensure_project_level(VIEWER, $p_project_id);
        $t_project_ids = user_get_all_accessible_subprojects($p_user_id, $p_project_id);
        array_unshift($t_project_ids, $p_project_id);
    }
    return $t_project_ids;
}
开发者ID:raultm,项目名称:mantisbt,代码行数:15,代码来源:user_api.php

示例7: mc_project_get_all_subprojects

/**
 * Get the list of subprojects for a given project
 * @param string  $p_username   The name of the user trying to access the versions.
 * @param string  $p_password   The password of the user.
 * @param integer $p_project_id The id of the project to retrieve the attachments for.
 * @return array
 */
function mc_project_get_all_subprojects($p_username, $p_password, $p_project_id)
{
    global $g_project_override;
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_access_denied();
    }
    if (!project_exists($p_project_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Project \'' . $p_project_id . '\' does not exist.');
    }
    $g_project_override = $p_project_id;
    if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return user_get_all_accessible_subprojects($t_user_id, $p_project_id);
}
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:23,代码来源:mc_project_api.php

示例8: mc_project_get_all_subprojects

function mc_project_get_all_subprojects($p_username, $p_password, $p_project_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_access_denied();
    }
    if (!project_exists($p_project_id)) {
        return SoapObjectsFactory::newSoapFault('Client', "Project '{$p_project_id}' does not exist.");
    }
    if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return user_get_all_accessible_subprojects($t_user_id, $p_project_id);
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:14,代码来源:mc_project_api.php

示例9: filter_get_bug_rows


//.........这里部分代码省略.........
    $t_new_project_ids = array();
    foreach ($t_project_ids as $t_pid) {
        if ($t_pid == META_FILTER_CURRENT) {
            $t_pid = $t_project_id;
        }
        if ($t_pid == ALL_PROJECTS) {
            $t_all_projects_found = true;
            log_event(LOG_FILTERING, 'FILTERING: all projects selected');
            break;
        }
        // filter out inaccessible projects.
        if (!access_has_project_level(VIEWER, $t_pid, $t_user_id)) {
            continue;
        }
        $t_new_project_ids[] = $t_pid;
    }
    $t_projects_query_required = true;
    if ($t_all_projects_found) {
        if (user_is_administrator($t_user_id)) {
            log_event(LOG_FILTERING, 'FILTERING: all projects + administrator, hence no project filter.');
            $t_projects_query_required = false;
        } else {
            $t_project_ids = user_get_accessible_projects($t_user_id);
        }
    } else {
        $t_project_ids = $t_new_project_ids;
    }
    if ($t_projects_query_required) {
        // expand project ids to include sub-projects
        if ($t_include_sub_projects) {
            $t_top_project_ids = $t_project_ids;
            foreach ($t_top_project_ids as $t_pid) {
                log_event(LOG_FILTERING, 'FILTERING: Getting sub-projects for project id ' . $t_pid);
                $t_project_ids = array_merge($t_project_ids, user_get_all_accessible_subprojects($t_user_id, $t_pid));
            }
            $t_project_ids = array_unique($t_project_ids);
        }
        // if no projects are accessible, then return an empty array.
        if (count($t_project_ids) == 0) {
            log_event(LOG_FILTERING, 'FILTERING: no accessible projects');
            return array();
        }
        log_event(LOG_FILTERING, 'FILTERING: project_ids after including sub-projects = ' . implode(',', $t_project_ids));
        // this array is to be populated with project ids for which we only want to show public issues.  This is due to the limited
        // access of the current user.
        $t_public_only_project_ids = array();
        // this array is populated with project ids that the current user has full access to.
        $t_private_and_public_project_ids = array();
        $t_access_required_to_view_private_bugs = config_get('private_bug_threshold');
        foreach ($t_project_ids as $t_pid) {
            if (access_has_project_level($t_access_required_to_view_private_bugs, $t_pid, $t_user_id)) {
                $t_private_and_public_project_ids[] = $t_pid;
            } else {
                $t_public_only_project_ids[] = $t_pid;
            }
        }
        log_event(LOG_FILTERING, 'FILTERING: project_ids (with public/private access) = ' . implode(',', $t_private_and_public_project_ids));
        log_event(LOG_FILTERING, 'FILTERING: project_ids (with public access) = ' . implode(',', $t_public_only_project_ids));
        $t_count_private_and_public_project_ids = count($t_private_and_public_project_ids);
        if ($t_count_private_and_public_project_ids == 1) {
            $t_private_and_public_query = "( {$t_bug_table}.project_id = " . $t_private_and_public_project_ids[0] . " )";
        } else {
            if ($t_count_private_and_public_project_ids > 1) {
                $t_private_and_public_query = "( {$t_bug_table}.project_id in (" . implode(', ', $t_private_and_public_project_ids) . ") )";
            } else {
                $t_private_and_public_query = null;
开发者ID:amjadtbssm,项目名称:website,代码行数:67,代码来源:filter_api.php

示例10: filter_get_bug_rows


//.........这里部分代码省略.........
    $t_new_project_ids = array();
    foreach ($t_project_ids as $t_pid) {
        if ($t_pid == META_FILTER_CURRENT) {
            $t_pid = $t_project_id;
        }
        if ($t_pid == ALL_PROJECTS) {
            $t_all_projects_found = true;
            log_event(LOG_FILTERING, 'all projects selected');
            break;
        }
        // filter out inaccessible projects.
        if (!access_has_project_level(VIEWER, $t_pid, $t_user_id)) {
            continue;
        }
        $t_new_project_ids[] = $t_pid;
    }
    $t_projects_query_required = true;
    if ($t_all_projects_found) {
        if (user_is_administrator($t_user_id)) {
            log_event(LOG_FILTERING, 'all projects + administrator, hence no project filter.');
            $t_projects_query_required = false;
        } else {
            $t_project_ids = user_get_accessible_projects($t_user_id);
        }
    } else {
        $t_project_ids = $t_new_project_ids;
    }
    if ($t_projects_query_required) {
        // expand project ids to include sub-projects
        if ($t_include_sub_projects) {
            $t_top_project_ids = $t_project_ids;
            foreach ($t_top_project_ids as $t_pid) {
                log_event(LOG_FILTERING, 'Getting sub-projects for project id @P' . $t_pid);
                $t_subproject_ids = user_get_all_accessible_subprojects($t_user_id, $t_pid);
                if (!$t_subproject_ids) {
                    continue;
                }
                $t_project_ids = array_merge($t_project_ids, $t_subproject_ids);
            }
            $t_project_ids = array_unique($t_project_ids);
        }
        // if no projects are accessible, then return an empty array.
        if (count($t_project_ids) == 0) {
            log_event(LOG_FILTERING, 'no accessible projects');
            return array();
        }
        log_event(LOG_FILTERING, 'project_ids after including sub-projects = @P' . implode(', @P', $t_project_ids));
        // this array is to be populated with project ids for which we only want to show public issues.  This is due to the limited
        // access of the current user.
        $t_public_only_project_ids = array();
        // this array is populated with project ids that the current user has full access to.
        $t_private_and_public_project_ids = array();
        foreach ($t_project_ids as $t_pid) {
            $t_access_required_to_view_private_bugs = config_get('private_bug_threshold', null, null, $t_pid);
            if (access_has_project_level($t_access_required_to_view_private_bugs, $t_pid, $t_user_id)) {
                $t_private_and_public_project_ids[] = $t_pid;
            } else {
                $t_public_only_project_ids[] = $t_pid;
            }
        }
        log_event(LOG_FILTERING, 'project_ids (with public/private access) = @P' . implode(', @P', $t_private_and_public_project_ids));
        log_event(LOG_FILTERING, 'project_ids (with public access) = @P' . implode(', @P', $t_public_only_project_ids));
        $t_count_private_and_public_project_ids = count($t_private_and_public_project_ids);
        if ($t_count_private_and_public_project_ids == 1) {
            $t_private_and_public_query = "( {$t_bug_table}.project_id = " . $t_private_and_public_project_ids[0] . " )";
        } else {
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:67,代码来源:filter_api.php

示例11: filter_get_bug_rows

function filter_get_bug_rows(&$p_page_number, &$p_per_page, &$p_page_count, &$p_bug_count, $p_custom_filter = null, $p_project_id = null, $p_user_id = null, $p_show_sticky = null)
{
    $t_bug_table = config_get('mantis_bug_table');
    $t_bug_text_table = config_get('mantis_bug_text_table');
    $t_bugnote_table = config_get('mantis_bugnote_table');
    $t_custom_field_string_table = config_get('mantis_custom_field_string_table');
    $t_bugnote_text_table = config_get('mantis_bugnote_text_table');
    $t_project_table = config_get('mantis_project_table');
    $t_bug_monitor_table = config_get('mantis_bug_monitor_table');
    $t_limit_reporters = config_get('limit_reporters');
    $t_bug_relationship_table = config_get('mantis_bug_relationship_table');
    $t_report_bug_threshold = config_get('report_bug_threshold');
    $t_current_user_id = auth_get_current_user_id();
    if (null === $p_user_id) {
        $t_user_id = $t_current_user_id;
    } else {
        $t_user_id = $p_user_id;
    }
    $c_user_id = db_prepare_int($t_user_id);
    if (null === $p_project_id) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = $p_project_id;
    }
    if ($p_custom_filter === null) {
        # Prefer current_user_get_bug_filter() over user_get_filter() when applicable since it supports
        # cookies set by previous version of the code.
        if ($t_user_id == $t_current_user_id) {
            $t_filter = current_user_get_bug_filter();
        } else {
            $t_filter = user_get_bug_filter($t_user_id, $t_project_id);
        }
    } else {
        $t_filter = $p_custom_filter;
    }
    $t_filter = filter_ensure_valid_filter($t_filter);
    if (false === $t_filter) {
        return false;
        # signify a need to create a cookie
        #@@@ error instead?
    }
    $t_where_clauses = array("{$t_project_table}.enabled = 1", "{$t_project_table}.id = {$t_bug_table}.project_id");
    $t_select_clauses = array("{$t_bug_table}.*");
    $t_join_clauses = array();
    $t_from_clauses = array();
    if (ALL_PROJECTS == $t_project_id) {
        if (!user_is_administrator($t_user_id)) {
            $t_topprojects = $t_projects = user_get_accessible_projects($t_user_id);
            foreach ($t_topprojects as $t_project) {
                $t_projects = array_merge($t_projects, user_get_all_accessible_subprojects($t_user_id, $t_project));
            }
            $t_projects = array_unique($t_projects);
            if (0 == count($t_projects)) {
                return array();
                # no accessible projects, return an empty array
            } else {
                if (1 == count($t_projects)) {
                    $t_project = $t_projects[0];
                    array_push($t_where_clauses, "( {$t_bug_table}.project_id={$t_project} )");
                } else {
                    array_push($t_where_clauses, "( {$t_bug_table}.project_id in (" . implode(', ', $t_projects) . ") )");
                }
            }
        }
    } else {
        access_ensure_project_level(VIEWER, $t_project_id, $t_user_id);
        $t_projects = user_get_all_accessible_subprojects($t_user_id, $t_project_id);
        $t_projects[] = $t_project_id;
        $t_projects = array_unique($t_projects);
        if (1 == count($t_projects)) {
            $t_project = $t_projects[0];
            array_push($t_where_clauses, "( {$t_bug_table}.project_id={$t_project} )");
        } else {
            array_push($t_where_clauses, "( {$t_bug_table}.project_id in (" . implode(', ', $t_projects) . ") )");
        }
    }
    # private bug selection
    if (!access_has_project_level(config_get('private_bug_threshold'), $t_project_id, $t_user_id)) {
        $t_public = VS_PUBLIC;
        $t_private = VS_PRIVATE;
        switch ($t_filter['view_state']) {
            case VS_PUBLIC:
                array_push($t_where_clauses, "({$t_bug_table}.view_state='{$t_public}')");
                break;
            case VS_PRIVATE:
                array_push($t_where_clauses, "({$t_bug_table}.view_state='{$t_private}' AND {$t_bug_table}.reporter_id='{$t_user_id}')");
                break;
            case META_FILTER_ANY:
            default:
                array_push($t_where_clauses, "({$t_bug_table}.view_state='{$t_public}' OR {$t_bug_table}.reporter_id='{$t_user_id}')");
                break;
        }
    } else {
        $t_view_state = db_prepare_int($t_filter['view_state']);
        if ($t_filter['view_state'] !== META_FILTER_ANY && !is_blank($t_filter['view_state'])) {
            array_push($t_where_clauses, "({$t_bug_table}.view_state='{$t_view_state}')");
        }
    }
    # reporter
    $t_any_found = false;
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:BenFund,代码行数:101,代码来源:filter_api.php


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