|
@@ 1758-1778 (lines=21) @@
|
| 1755 |
|
* @return HTMLText |
| 1756 |
|
* @throws SS_HTTPResponse_Exception |
| 1757 |
|
*/ |
| 1758 |
|
public function restoresnapshot(SS_HTTPRequest $request) { |
| 1759 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1760 |
|
|
| 1761 |
|
/** @var DNDataArchive $dataArchive */ |
| 1762 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1763 |
|
|
| 1764 |
|
if(!$dataArchive) { |
| 1765 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1766 |
|
} |
| 1767 |
|
|
| 1768 |
|
// We check for canDownload because that implies access to the data. |
| 1769 |
|
// canRestore is later checked on the actual restore action per environment. |
| 1770 |
|
if(!$dataArchive->canDownload()) { |
| 1771 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1772 |
|
} |
| 1773 |
|
|
| 1774 |
|
$form = $this->getDataTransferRestoreForm($this->request, $dataArchive); |
| 1775 |
|
|
| 1776 |
|
// View currently only available via ajax |
| 1777 |
|
return $form->forTemplate(); |
| 1778 |
|
} |
| 1779 |
|
|
| 1780 |
|
/** |
| 1781 |
|
* View a form to delete a specific {@link DataArchive}. |
|
@@ 1790-1808 (lines=19) @@
|
| 1787 |
|
* @return HTMLText |
| 1788 |
|
* @throws SS_HTTPResponse_Exception |
| 1789 |
|
*/ |
| 1790 |
|
public function deletesnapshot(SS_HTTPRequest $request) { |
| 1791 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1792 |
|
|
| 1793 |
|
/** @var DNDataArchive $dataArchive */ |
| 1794 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1795 |
|
|
| 1796 |
|
if(!$dataArchive) { |
| 1797 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1798 |
|
} |
| 1799 |
|
|
| 1800 |
|
if(!$dataArchive->canDelete()) { |
| 1801 |
|
throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403); |
| 1802 |
|
} |
| 1803 |
|
|
| 1804 |
|
$form = $this->getDeleteForm($this->request, $dataArchive); |
| 1805 |
|
|
| 1806 |
|
// View currently only available via ajax |
| 1807 |
|
return $form->forTemplate(); |
| 1808 |
|
} |
| 1809 |
|
|
| 1810 |
|
/** |
| 1811 |
|
* @param SS_HTTPRequest $request |
|
@@ 1892-1911 (lines=20) @@
|
| 1889 |
|
* @return HTMLText |
| 1890 |
|
* @throws SS_HTTPResponse_Exception |
| 1891 |
|
*/ |
| 1892 |
|
public function movesnapshot(SS_HTTPRequest $request) { |
| 1893 |
|
$this->setCurrentActionType(self::ACTION_SNAPSHOT); |
| 1894 |
|
|
| 1895 |
|
/** @var DNDataArchive $dataArchive */ |
| 1896 |
|
$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID')); |
| 1897 |
|
|
| 1898 |
|
if(!$dataArchive) { |
| 1899 |
|
throw new SS_HTTPResponse_Exception('Archive not found', 404); |
| 1900 |
|
} |
| 1901 |
|
|
| 1902 |
|
// We check for canDownload because that implies access to the data. |
| 1903 |
|
if(!$dataArchive->canDownload()) { |
| 1904 |
|
throw new SS_HTTPResponse_Exception('Not allowed to access archive', 403); |
| 1905 |
|
} |
| 1906 |
|
|
| 1907 |
|
$form = $this->getMoveForm($this->request, $dataArchive); |
| 1908 |
|
|
| 1909 |
|
// View currently only available via ajax |
| 1910 |
|
return $form->forTemplate(); |
| 1911 |
|
} |
| 1912 |
|
|
| 1913 |
|
/** |
| 1914 |
|
* Build snapshot move form. |