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


PHP REDCap::getUserRights方法代码示例

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


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

示例1: exit

    $stmt->close();
    return -3;
}
// mgGetNumberOfKeyValuePairsForRecord
$scrf = PAGE_FULL;
/*****************************************************************************/
if (!array_key_exists("records_to_delete_textarea", $_POST)) {
    // Present the form
    if (!array_key_exists("pid", $_GET) or !($proj_id = $_GET["pid"])) {
        exit("<b>Missing project number</b>. Make sure your URL appends \"<tt>?pid=123</tt>\" where <i>123</i> is your project number.");
    }
    $scrf .= "?pid=" . $proj_id;
    if (!SUPER_USER) {
        // Get array of user privileges for a single user in project (will have username as array key)
        $this_user = USERID;
        $rights = REDCap::getUserRights($this_user);
        // If $rights returns NULL, then user does not have access to this project
        if (empty($this_user) or empty($rights)) {
            exit("User {$this_user} does NOT have access to this project.");
        }
        // Check if user can delete records
        if (!$rights[$this_user]['record_delete']) {
            exit("User {$this_user} does NOT have permission to delete records from this project.");
        }
    }
    // echo "<p>The project is $proj_id.</p>"
    ?>

<p>Please paste in a list record numbers to delete, one per-line or separated by spaces. </p>
<p>Note that there is <i>no</i> confirmation of deletion!  Once you click the DELETE RECORDS button below your supplied records will be <b>permanently deleted</b> from this project, so please double-check your list before proceeding. </p>
<form action="
开发者ID:rito-mg,项目名称:REDCap,代码行数:31,代码来源:batch_delete_records.php

示例2: dirname

$base_path = dirname(dirname(dirname(__FILE__)));
require_once $base_path . "/redcap_connect.php";
require_once $base_path . '/plugins/includes/functions.php';
/**
 * restricted use
 */
$allowed_pids = array('38');
REDCap::allowProjects($allowed_pids);
Kint::enabled($debug);

// Set number of fields to export at a time.
$fields_per_batch = 80000;

// Check user privs
if (!SUPER_USER) {
	$rights = REDCap::getUserRights(USERID);
	$rights = $rights[USERID];
	//echo "<pre>" . print_r($rights,true) . "</pre>";
	d($rights);
	if ($rights['data_export_tool'] != 1) {
		include APP_PATH_DOCROOT . 'ProjectGeneral/header.php';
		displayMsg("You do not have proper data export rights to use this tool ({$rights[USERID]['data_export_tool']})", "errorMsg","center","red","exclamation_frame.png", 600);
		exit();
	}
}

// Check if we are posting back for a download
if(isset($_POST['download'])) {
	// Request to download a processed file
	$target_filename = $_POST['download'];
	$target_file = APP_PATH_TEMP . $target_filename;
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:export_all.php


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