* @apiPermission Author of the Channel * @apiUse NotPermitted * @apiUse MissingParameter * */ $app->put('/channel/sorting', function () use($app) { include_once 'libs/channel.php'; updateOrder($app->request->getBody()); }); /** * * @api {DELETE} /channel/:channelId/unit/:unitId Delete a Unit from Channel * @apiName deleteUnitFromChannel * @apiGroup Channel * @apiVersion 1.0.0 * * @apiParam {Number} id Id of Unit to delete * @apiParamExample {json} Request-Example: * { * "id": "42", * } * * @apiPermission Author of the Parent Channel * @apiUse NotPermitted * @apiUse MissingParameter * */ $app->delete('/channel/:channelId/unit/:unitId', function ($channelId, $unitId) { include_once 'libs/unit.php'; deleteUnitFromChannel($unitId, $channelId); });
function updateUnitParent($unit) { if (!isset($unit['parent']) || !isset($unit['id']) || !isset($unit['oldParent'])) { malformed_request('Missing parent, oldParent or id'); } check_channel_privileges($unit['parent'], AUTHOR); check_channel_privileges($unit['oldParent'], AUTHOR); deleteUnitFromChannel($unit['id'], $unit['oldParent']); addUnitToChannel($unit['id'], $unit['parent']); }