Ejemplo n.º 1
0
function permission4resource($P)
{
    extract($P);
    if ($P['shared_with'] == '') {
        $P['shared_with'] = 'U' . $P['user_id'];
    }
    if ($P['uid'] == '') {
        $P['uid'] = $P['id'];
    }
    if ($P['shared_with'] == 'U1') {
        return 'YYY';
    }
    $toFind = $P['uid'];
    $shared_with_user = $P['shared_with'];
    #$Z = compact('toFind', 'shared_with_user','user_id', 'db','uidQuery', 'timer');
    $Z = compact('toFind', 'shared_with_user', 'user_id', 'db', 'uidQuery', 'timer', 'toFindInfo');
    $results = permissionPropagation($Z);
    if ($results[$toFind]) {
        ##For now, put the result back in the model in which it was found
        return $results[$toFind];
    } else {
        return 'nnn';
        ##Old Mode for now
    }
}
Ejemplo n.º 2
0
function permissionsQuery($s3ql, $element, $element_id, $user_id, $db)
{
    $letter = strtoupper(substr($s3ql['from'], 0, 1));
    $shared_with_user = 'U' . $user_id;
    $ids = permissionPropagation($letter, $shared_with_user, $user_id, $db);
    #echo '<pre>';print_r($ids);exit;
    if (!empty($ids)) {
        foreach ($ids as $uid => $pl) {
            $finalUID .= $finalUID == '' ? " " . $GLOBALS['s3ids'][$element] . " = '" . substr($uid, 1, strlen($uid)) . "'" : " or " . $GLOBALS['s3ids'][$element] . " = '" . substr($uid, 1, strlen($uid)) . "'";
            $array_ids[$uid] = $pl;
            $str_ids .= $str_ids == '' ? substr($uid, 1, strlen($uid)) : '|' . substr($uid, 1, strlen($uid));
        }
        $finalUID = " and (" . $finalUID . ")";
        $return = compact('finalUID', 'str_ids', 'array_ids');
        return $return;
    } else {
        return False;
    }
}