}, 'Org subfolders in Shared Meetings folder'); /** * CREATE rooms from POSTED data (CSV, prefix and folder) */ $router->map('POST', '/rooms/create/', function () { verifyOrgAccess($_POST['user_org_shortname']); global $connect; Response::result($connect->createRooms($_POST)); }); /** * CREATE users from POSTED data */ $router->map('POST', '/users/create/', function () { verifyOrgAccess($_POST['user_org_shortname']); global $connect; Response::result($connect->createUsers($_POST)); }); // -------------------- UTILS -------------------- // // Make sure requested org name is the same as logged in user's org function verifyOrgAccess($orgName) { global $dataporten; if (strcasecmp($orgName, $dataporten->getUserOrg()) !== 0) { Response::error(401, $_SERVER["SERVER_PROTOCOL"] . ' 401 Unauthorized (request mismatch org/user). '); } } /** * * * http://stackoverflow.com/questions/4861053/php-sanitize-values-of-a-array/4861211#4861211 */