|
@@ 1845-1865 (lines=21) @@
|
| 1842 |
|
* @return HTMLText |
| 1843 |
|
* @throws SS_HTTPResponse_Exception |
| 1844 |
|
*/ |
| 1845 |
|
public function restoresnapshot(SS_HTTPRequest $request) { |
| 1846 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1847 |
|
|
| 1848 |
|
/** @var DNDataArchive $dataArchive */ |
| 1849 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1850 |
|
|
| 1851 |
|
if(!$dataArchive) { |
| 1852 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1853 |
|
} |
| 1854 |
|
|
| 1855 |
|
// We check for canDownload because that implies access to the data. |
| 1856 |
|
// canRestore is later checked on the actual restore action per environment. |
| 1857 |
|
if(!$dataArchive->canDownload()) { |
| 1858 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1859 |
|
} |
| 1860 |
|
|
| 1861 |
|
$form = $this->getDataTransferRestoreForm($this->request, $dataArchive); |
| 1862 |
|
|
| 1863 |
|
// View currently only available via ajax |
| 1864 |
|
return $form->forTemplate(); |
| 1865 |
|
} |
| 1866 |
|
|
| 1867 |
|
/** |
| 1868 |
|
* View a form to delete a specific {@link DataArchive}. |
|
@@ 1877-1895 (lines=19) @@
|
| 1874 |
|
* @return HTMLText |
| 1875 |
|
* @throws SS_HTTPResponse_Exception |
| 1876 |
|
*/ |
| 1877 |
|
public function deletesnapshot(SS_HTTPRequest $request) { |
| 1878 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1879 |
|
|
| 1880 |
|
/** @var DNDataArchive $dataArchive */ |
| 1881 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1882 |
|
|
| 1883 |
|
if(!$dataArchive) { |
| 1884 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1885 |
|
} |
| 1886 |
|
|
| 1887 |
|
if(!$dataArchive->canDelete()) { |
| 1888 |
|
throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1889 |
|
} |
| 1890 |
|
|
| 1891 |
|
$form = $this->getDeleteForm($this->request, $dataArchive); |
| 1892 |
|
|
| 1893 |
|
// View currently only available via ajax |
| 1894 |
|
return $form->forTemplate(); |
| 1895 |
|
} |
| 1896 |
|
|
| 1897 |
|
/** |
| 1898 |
|
* @param SS_HTTPRequest $request |
|
@@ 1979-1998 (lines=20) @@
|
| 1976 |
|
* @return HTMLText |
| 1977 |
|
* @throws SS_HTTPResponse_Exception |
| 1978 |
|
*/ |
| 1979 |
|
public function movesnapshot(SS_HTTPRequest $request) { |
| 1980 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1981 |
|
|
| 1982 |
|
/** @var DNDataArchive $dataArchive */ |
| 1983 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1984 |
|
|
| 1985 |
|
if(!$dataArchive) { |
| 1986 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1987 |
|
} |
| 1988 |
|
|
| 1989 |
|
// We check for canDownload because that implies access to the data. |
| 1990 |
|
if(!$dataArchive->canDownload()) { |
| 1991 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1992 |
|
} |
| 1993 |
|
|
| 1994 |
|
$form = $this->getMoveForm($this->request, $dataArchive); |
| 1995 |
|
|
| 1996 |
|
// View currently only available via ajax |
| 1997 |
|
return $form->forTemplate(); |
| 1998 |
|
} |
| 1999 |
|
|
| 2000 |
|
/** |
| 2001 |
|
* Build snapshot move form. |