|
@@ 1810-1830 (lines=21) @@
|
| 1807 |
|
* @return HTMLText |
| 1808 |
|
* @throws SS_HTTPResponse_Exception |
| 1809 |
|
*/ |
| 1810 |
|
public function restoresnapshot(SS_HTTPRequest $request) { |
| 1811 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1812 |
|
|
| 1813 |
|
/** @var DNDataArchive $dataArchive */ |
| 1814 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1815 |
|
|
| 1816 |
|
if(!$dataArchive) { |
| 1817 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1818 |
|
} |
| 1819 |
|
|
| 1820 |
|
// We check for canDownload because that implies access to the data. |
| 1821 |
|
// canRestore is later checked on the actual restore action per environment. |
| 1822 |
|
if(!$dataArchive->canDownload()) { |
| 1823 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1824 |
|
} |
| 1825 |
|
|
| 1826 |
|
$form = $this->getDataTransferRestoreForm($this->request, $dataArchive); |
| 1827 |
|
|
| 1828 |
|
// View currently only available via ajax |
| 1829 |
|
return $form->forTemplate(); |
| 1830 |
|
} |
| 1831 |
|
|
| 1832 |
|
/** |
| 1833 |
|
* View a form to delete a specific {@link DataArchive}. |
|
@@ 1842-1860 (lines=19) @@
|
| 1839 |
|
* @return HTMLText |
| 1840 |
|
* @throws SS_HTTPResponse_Exception |
| 1841 |
|
*/ |
| 1842 |
|
public function deletesnapshot(SS_HTTPRequest $request) { |
| 1843 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1844 |
|
|
| 1845 |
|
/** @var DNDataArchive $dataArchive */ |
| 1846 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1847 |
|
|
| 1848 |
|
if(!$dataArchive) { |
| 1849 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1850 |
|
} |
| 1851 |
|
|
| 1852 |
|
if(!$dataArchive->canDelete()) { |
| 1853 |
|
throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1854 |
|
} |
| 1855 |
|
|
| 1856 |
|
$form = $this->getDeleteForm($this->request, $dataArchive); |
| 1857 |
|
|
| 1858 |
|
// View currently only available via ajax |
| 1859 |
|
return $form->forTemplate(); |
| 1860 |
|
} |
| 1861 |
|
|
| 1862 |
|
/** |
| 1863 |
|
* @param SS_HTTPRequest $request |
|
@@ 1944-1963 (lines=20) @@
|
| 1941 |
|
* @return HTMLText |
| 1942 |
|
* @throws SS_HTTPResponse_Exception |
| 1943 |
|
*/ |
| 1944 |
|
public function movesnapshot(SS_HTTPRequest $request) { |
| 1945 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1946 |
|
|
| 1947 |
|
/** @var DNDataArchive $dataArchive */ |
| 1948 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1949 |
|
|
| 1950 |
|
if(!$dataArchive) { |
| 1951 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1952 |
|
} |
| 1953 |
|
|
| 1954 |
|
// We check for canDownload because that implies access to the data. |
| 1955 |
|
if(!$dataArchive->canDownload()) { |
| 1956 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1957 |
|
} |
| 1958 |
|
|
| 1959 |
|
$form = $this->getMoveForm($this->request, $dataArchive); |
| 1960 |
|
|
| 1961 |
|
// View currently only available via ajax |
| 1962 |
|
return $form->forTemplate(); |
| 1963 |
|
} |
| 1964 |
|
|
| 1965 |
|
/** |
| 1966 |
|
* Build snapshot move form. |