本文整理汇总了PHP中project_add_user函数的典型用法代码示例。如果您正苦于以下问题:PHP project_add_user函数的具体用法?PHP project_add_user怎么用?PHP project_add_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了project_add_user函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: require_api
* @uses gpc_api.php
* @uses print_api.php
* @uses project_api.php
*/
/**
* MantisBT Core API's
*/
require_once 'core.php';
require_api('access_api.php');
require_api('authentication_api.php');
require_api('config_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('print_api.php');
require_api('project_api.php');
form_security_validate('manage_proj_user_add');
auth_reauthenticate();
$f_project_id = gpc_get_int('project_id');
$f_user_id = gpc_get_int_array('user_id', array());
$f_access_level = gpc_get_int('access_level');
# We should check both since we are in the project section and an
# admin might raise the first threshold and not realize they need
# to raise the second
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
access_ensure_project_level(config_get('project_user_threshold'), $f_project_id);
# Add user(s) to the current project
foreach ($f_user_id as $t_user_id) {
project_add_user($f_project_id, $t_user_id, $f_access_level);
}
form_security_purge('manage_proj_user_add');
print_header_redirect('manage_proj_edit_page.php?project_id=' . $f_project_id);
示例2: require_api
require_api('project_api.php');
require_api('project_hierarchy_api.php');
form_security_validate('manage_proj_create');
auth_reauthenticate();
access_ensure_global_level(config_get('create_project_threshold'));
$f_name = gpc_get_string('name');
$f_description = gpc_get_string('description');
$f_view_state = gpc_get_int('view_state');
$f_status = gpc_get_int('status');
$f_file_path = gpc_get_string('file_path', '');
$f_inherit_global = gpc_get_bool('inherit_global', 0);
$f_inherit_parent = gpc_get_bool('inherit_parent', 0);
$f_parent_id = gpc_get_int('parent_id', 0);
if (0 != $f_parent_id) {
project_ensure_exists($f_parent_id);
}
$t_project_id = project_create(strip_tags($f_name), $f_description, $f_status, $f_view_state, $f_file_path, true, $f_inherit_global);
if ($f_view_state == VS_PRIVATE && false === current_user_is_administrator()) {
$t_access_level = access_get_global_level();
$t_current_user_id = auth_get_current_user_id();
project_add_user($t_project_id, $t_current_user_id, $t_access_level);
}
if (0 != $f_parent_id) {
project_hierarchy_add($t_project_id, $f_parent_id, $f_inherit_parent);
}
event_signal('EVENT_MANAGE_PROJECT_CREATE', array($t_project_id));
form_security_purge('manage_proj_create');
$t_redirect_url = 'manage_proj_page.php';
html_page_top(null, $t_redirect_url);
html_operation_successful($t_redirect_url);
html_page_bottom();
示例3: form_security_validate
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once 'core.php';
form_security_validate('manage_user_proj_add');
auth_reauthenticate();
$f_user_id = gpc_get_int('user_id');
$f_access_level = gpc_get_int('access_level');
$f_project_id = gpc_get_int_array('project_id', array());
$t_manage_user_threshold = config_get('manage_user_threshold');
user_ensure_exists($f_user_id);
foreach ($f_project_id as $t_proj_id) {
if (access_has_project_level($t_manage_user_threshold, $t_proj_id) && access_has_project_level($f_access_level, $t_proj_id)) {
project_add_user($t_proj_id, $f_user_id, $f_access_level);
}
}
form_security_purge('manage_user_proj_add');
print_header_redirect('manage_user_edit_page.php?user_id=' . $f_user_id);
示例4: project_copy_users
/**
* Copy all users and their permissions from the source project to the
* destination project. The $p_access_level_limit parameter can be used to
* limit the access level for users as they're copied to the destination
* project (the highest access level they'll receieve in the destination
* project will be equal to $p_access_level_limit).
* @param int Destination project ID
* @param int Source project ID
* @param int Access level limit (null = no limit)
* @return null
*/
function project_copy_users($p_destination_id, $p_source_id, $p_access_level_limit = null)
{
# Copy all users from current project over to another project
$t_rows = project_get_local_user_rows($p_source_id);
$t_count = count($t_rows);
for ($i = 0; $i < $t_count; $i++) {
$t_row = $t_rows[$i];
if ($p_access_level_limit !== null && $t_row['access_level'] > $p_access_level_limit) {
$t_destination_access_level = $p_access_level_limit;
} else {
$t_destination_access_level = $t_row['access_level'];
}
# if there is no duplicate then add a new entry
# otherwise just update the access level for the existing entry
if (project_includes_user($p_destination_id, $t_row['user_id'])) {
project_update_user_access($p_destination_id, $t_row['user_id'], $t_destination_access_level);
} else {
project_add_user($p_destination_id, $t_row['user_id'], $t_destination_access_level);
}
}
}
示例5: project_copy_users
function project_copy_users($p_destination_id, $p_source_id)
{
# Copy all users from current project over to another project
$rows = project_get_local_user_rows($p_source_id);
for ($i = 0; $i < sizeof($rows); $i++) {
extract($rows[$i], EXTR_PREFIX_ALL, 'v');
# if there is no duplicate then add a new entry
# otherwise just update the access level for the existing entry
if (project_includes_user($p_destination_id, $v_user_id)) {
project_update_user_access($p_destination_id, $v_user_id, $v_access_level);
} else {
project_add_user($p_destination_id, $v_user_id, $v_access_level);
}
}
}