Exemple #1
0
function handleActions($request)
{
    if (is_array($request) && isset($request['action'])) {
        switch ($request['action']) {
            case 'createNewFolder':
                return createNewFolder($request['idUser'], $request['path'], $request['folderName'], $request['inheritRightsFromParent']);
                break;
            case 'rename':
                return renameHandler($request['idElement'], $request['idUser'], $request['name'], $request['options']);
                break;
            case 'move':
                return moveHandler($request['idElement'], $request['idUser'], $request['path'], $request['options']);
                break;
            case 'disable':
                return disableHandler($request['idElement'], $request['idUser'], $request['returnImpactedElements']);
                break;
            case 'copy':
                return copyHandler($request['idElement'], $request['idUser'], $request['path'], $request['options']);
                break;
            case 'uplodad':
                break;
            case 'download':
                break;
            case 'shareWithUser':
                return shareWithUser($request['idElement'], $request['idUser'], $request['email'], $request['code']);
                break;
            case 'anonymousShare':
                break;
        }
    } else {
        return array('error' => 'Action parameter required, none found');
    }
}
Exemple #2
0
<?php

$projectRoot = $_SERVER['DOCUMENT_ROOT'] . '/Nestbox';
require_once $projectRoot . '/required.php';
/**
 * Created by PhpStorm.
 * User: Harry
 * Date: 12/06/14
 * Time: 19:42
 */
/* Si l'utilsateur décide de partager un élément à un utilisateur */
if (isset($_POST['email']) && isset($_POST['refRight']) && isset($_POST['idElement'])) {
    $shareResult = shareWithUser($_POST['idElement'], $userId, $_POST['email'], $_POST['refRight']);
    if (is_array($shareResult) && array_key_exists('error', $shareResult)) {
        if ($shareResult['error'] == 'You cannot share an element with yourself') {
            echo $shareResult['error'] . '. Please enter an another email.';
        } else {
            echo $shareResult['error'] . ' Please enter an another email or choose anonymous share.';
        }
    } else {
        echo 'Right has been successfully applied for element and user with email ' . $_POST['email'];
    }
}