|
@@ 1703-1723 (lines=21) @@
|
| 1700 |
|
* @return HTMLText |
| 1701 |
|
* @throws SS_HTTPResponse_Exception |
| 1702 |
|
*/ |
| 1703 |
|
public function restoresnapshot(\SS_HTTPRequest $request) { |
| 1704 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1705 |
|
|
| 1706 |
|
/** @var DNDataArchive $dataArchive */ |
| 1707 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1708 |
|
|
| 1709 |
|
if (!$dataArchive) { |
| 1710 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1711 |
|
} |
| 1712 |
|
|
| 1713 |
|
// We check for canDownload because that implies access to the data. |
| 1714 |
|
// canRestore is later checked on the actual restore action per environment. |
| 1715 |
|
if (!$dataArchive->canDownload()) { |
| 1716 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1717 |
|
} |
| 1718 |
|
|
| 1719 |
|
$form = $this->getDataTransferRestoreForm($this->request, $dataArchive); |
| 1720 |
|
|
| 1721 |
|
// View currently only available via ajax |
| 1722 |
|
return $form->forTemplate(); |
| 1723 |
|
} |
| 1724 |
|
|
| 1725 |
|
/** |
| 1726 |
|
* View a form to delete a specific {@link DataArchive}. |
|
@@ 1735-1753 (lines=19) @@
|
| 1732 |
|
* @return HTMLText |
| 1733 |
|
* @throws SS_HTTPResponse_Exception |
| 1734 |
|
*/ |
| 1735 |
|
public function deletesnapshot(\SS_HTTPRequest $request) { |
| 1736 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1737 |
|
|
| 1738 |
|
/** @var DNDataArchive $dataArchive */ |
| 1739 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1740 |
|
|
| 1741 |
|
if (!$dataArchive) { |
| 1742 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1743 |
|
} |
| 1744 |
|
|
| 1745 |
|
if (!$dataArchive->canDelete()) { |
| 1746 |
|
throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1747 |
|
} |
| 1748 |
|
|
| 1749 |
|
$form = $this->getDeleteForm($this->request, $dataArchive); |
| 1750 |
|
|
| 1751 |
|
// View currently only available via ajax |
| 1752 |
|
return $form->forTemplate(); |
| 1753 |
|
} |
| 1754 |
|
|
| 1755 |
|
/** |
| 1756 |
|
* @param \SS_HTTPRequest $request |
|
@@ 1837-1856 (lines=20) @@
|
| 1834 |
|
* @return HTMLText |
| 1835 |
|
* @throws SS_HTTPResponse_Exception |
| 1836 |
|
*/ |
| 1837 |
|
public function movesnapshot(\SS_HTTPRequest $request) { |
| 1838 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1839 |
|
|
| 1840 |
|
/** @var DNDataArchive $dataArchive */ |
| 1841 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1842 |
|
|
| 1843 |
|
if (!$dataArchive) { |
| 1844 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1845 |
|
} |
| 1846 |
|
|
| 1847 |
|
// We check for canDownload because that implies access to the data. |
| 1848 |
|
if (!$dataArchive->canDownload()) { |
| 1849 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1850 |
|
} |
| 1851 |
|
|
| 1852 |
|
$form = $this->getMoveForm($this->request, $dataArchive); |
| 1853 |
|
|
| 1854 |
|
// View currently only available via ajax |
| 1855 |
|
return $form->forTemplate(); |
| 1856 |
|
} |
| 1857 |
|
|
| 1858 |
|
/** |
| 1859 |
|
* Build snapshot move form. |