|
@@ 1778-1798 (lines=21) @@
|
| 1775 |
|
* @return HTMLText |
| 1776 |
|
* @throws SS_HTTPResponse_Exception |
| 1777 |
|
*/ |
| 1778 |
|
public function restoresnapshot(SS_HTTPRequest $request) { |
| 1779 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1780 |
|
|
| 1781 |
|
/** @var DNDataArchive $dataArchive */ |
| 1782 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1783 |
|
|
| 1784 |
|
if(!$dataArchive) { |
| 1785 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1786 |
|
} |
| 1787 |
|
|
| 1788 |
|
// We check for canDownload because that implies access to the data. |
| 1789 |
|
// canRestore is later checked on the actual restore action per environment. |
| 1790 |
|
if(!$dataArchive->canDownload()) { |
| 1791 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1792 |
|
} |
| 1793 |
|
|
| 1794 |
|
$form = $this->getDataTransferRestoreForm($this->request, $dataArchive); |
| 1795 |
|
|
| 1796 |
|
// View currently only available via ajax |
| 1797 |
|
return $form->forTemplate(); |
| 1798 |
|
} |
| 1799 |
|
|
| 1800 |
|
/** |
| 1801 |
|
* View a form to delete a specific {@link DataArchive}. |
|
@@ 1810-1828 (lines=19) @@
|
| 1807 |
|
* @return HTMLText |
| 1808 |
|
* @throws SS_HTTPResponse_Exception |
| 1809 |
|
*/ |
| 1810 |
|
public function deletesnapshot(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 |
|
if(!$dataArchive->canDelete()) { |
| 1821 |
|
throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1822 |
|
} |
| 1823 |
|
|
| 1824 |
|
$form = $this->getDeleteForm($this->request, $dataArchive); |
| 1825 |
|
|
| 1826 |
|
// View currently only available via ajax |
| 1827 |
|
return $form->forTemplate(); |
| 1828 |
|
} |
| 1829 |
|
|
| 1830 |
|
/** |
| 1831 |
|
* @param SS_HTTPRequest $request |
|
@@ 1912-1931 (lines=20) @@
|
| 1909 |
|
* @return HTMLText |
| 1910 |
|
* @throws SS_HTTPResponse_Exception |
| 1911 |
|
*/ |
| 1912 |
|
public function movesnapshot(SS_HTTPRequest $request) { |
| 1913 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1914 |
|
|
| 1915 |
|
/** @var DNDataArchive $dataArchive */ |
| 1916 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1917 |
|
|
| 1918 |
|
if(!$dataArchive) { |
| 1919 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1920 |
|
} |
| 1921 |
|
|
| 1922 |
|
// We check for canDownload because that implies access to the data. |
| 1923 |
|
if(!$dataArchive->canDownload()) { |
| 1924 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1925 |
|
} |
| 1926 |
|
|
| 1927 |
|
$form = $this->getMoveForm($this->request, $dataArchive); |
| 1928 |
|
|
| 1929 |
|
// View currently only available via ajax |
| 1930 |
|
return $form->forTemplate(); |
| 1931 |
|
} |
| 1932 |
|
|
| 1933 |
|
/** |
| 1934 |
|
* Build snapshot move form. |